mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
listinvoice: populate local_offer_id when iterating whole db.
And add the local_offer_id to the schemas too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-EXPERIMENTAL: JSONRPC: `listoffers` now shows `local_offer_id` when listing all offers.
This commit is contained in:
parent
68962083e7
commit
33a40ca73b
2
doc/lightning-delinvoice.7
generated
2
doc/lightning-delinvoice.7
generated
@ -93,4 +93,4 @@ Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:ff36afbf0c8f27efd0c6e82f32ba783e511f53f5978342b210ba78038c1934bf
|
||||
\" SHA256STAMP:59f9becf74ee1b70ad9eb4316baaed1d26a95e34c3a5000e095fc8b7bfa291cf
|
||||
|
@ -71,4 +71,4 @@ RESOURCES
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:6435d88007d1b21e97c969cc202e240ed57df572a3312a6b77ea66ed3a8d512a)
|
||||
[comment]: # ( SHA256STAMP:62a3bdd502ed0b3b555f3cfda6a0e5f7c2417ce0f5b23202d613216de58a23f3)
|
||||
|
4
doc/lightning-listinvoices.7
generated
4
doc/lightning-listinvoices.7
generated
@ -37,6 +37,8 @@ On success, an object containing \fBinvoices\fR is returned\. It is an array of
|
||||
\fBbolt11\fR (string, optional): the BOLT11 string (always present unless \fIbolt12\fR is)
|
||||
.IP \[bu]
|
||||
\fBbolt12\fR (string, optional): the BOLT12 string (always present unless \fIbolt11\fR is)
|
||||
.IP \[bu]
|
||||
\fBlocal_offer_id\fR (hex, optional): the \fIid\fR of our offer which created this invoice (\fBexperimental-offers\fR only)\. (always 64 characters)
|
||||
|
||||
.RE
|
||||
|
||||
@ -65,4 +67,4 @@ Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:1ac6fb88dc05d683e81dc951a593d88027310b9c62dd81c57e134238994b0562
|
||||
\" SHA256STAMP:d6bc8b6c09aee1f5e29900fffacbc9d3fdf1e32d27e7b90b0709a5f50ecb5c13
|
||||
|
@ -30,6 +30,7 @@ On success, an object containing **invoices** is returned. It is an array of ob
|
||||
- **amount_msat** (msat, optional): the amount required to pay this invoice
|
||||
- **bolt11** (string, optional): the BOLT11 string (always present unless *bolt12* is)
|
||||
- **bolt12** (string, optional): the BOLT12 string (always present unless *bolt11* is)
|
||||
- **local_offer_id** (hex, optional): the *id* of our offer which created this invoice (**experimental-offers** only). (always 64 characters)
|
||||
|
||||
If **status** is "paid":
|
||||
- **pay_index** (u64): Unique incrementing index for this payment
|
||||
@ -53,4 +54,4 @@ RESOURCES
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:67ff5d9aa945301f23d6694304e4b657a37f0b3f80cc1c13c2ff23a55fe51d4b)
|
||||
[comment]: # ( SHA256STAMP:cc6d7b4549d2ab905ab18041f34d13143e4ffed2bb6cc7c1df0307800e59a2fa)
|
||||
|
@ -111,6 +111,7 @@
|
||||
"amount_msat": { },
|
||||
"description": { },
|
||||
"payment_hash": { },
|
||||
"local_offer_id": { },
|
||||
"pay_index": {
|
||||
"type": "u64",
|
||||
"description": "unique index for this invoice payment"
|
||||
|
@ -48,6 +48,12 @@
|
||||
"bolt12": {
|
||||
"type": "string",
|
||||
"description": "the BOLT12 string (always present unless *bolt11* is)"
|
||||
},
|
||||
"local_offer_id": {
|
||||
"type": "hex",
|
||||
"description": "the *id* of our offer which created this invoice (**experimental-offers** only).",
|
||||
"maxLength": 64,
|
||||
"minLength": 64
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
@ -72,6 +78,7 @@
|
||||
"amount_msat": { },
|
||||
"bolt11": { },
|
||||
"bolt12": { },
|
||||
"local_offer_id": { },
|
||||
"expires_at": { },
|
||||
"pay_index": {
|
||||
"type": "u64",
|
||||
@ -107,6 +114,7 @@
|
||||
"amount_msat": { },
|
||||
"bolt11": { },
|
||||
"bolt12": { },
|
||||
"local_offer_id": { },
|
||||
"expires_at": { }
|
||||
}
|
||||
}
|
||||
|
@ -3995,6 +3995,9 @@ def test_fetchinvoice(node_factory, bitcoind):
|
||||
l1.rpc.pay(inv2['invoice'])
|
||||
assert only_one(l3.rpc.call('listoffers', [offer1['offer_id']])['offers'])['used'] is True
|
||||
|
||||
# listinvoices will show these on l3
|
||||
assert [x['local_offer_id'] for x in l3.rpc.listinvoices()['invoices']] == [offer1['offer_id'], offer1['offer_id']]
|
||||
|
||||
# We can also set the amount explicitly, to tip.
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'msatoshi': 3})
|
||||
assert l1.rpc.call('decode', [inv1['invoice']])['amount_msat'] == 3
|
||||
|
6
wallet/db_postgres_sqlgen.c
generated
6
wallet/db_postgres_sqlgen.c
generated
@ -1131,8 +1131,8 @@ struct db_query db_postgres_queries[] = {
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features FROM invoices ORDER BY id;",
|
||||
.query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features FROM invoices ORDER BY id;",
|
||||
.name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;",
|
||||
.query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;",
|
||||
.placeholders = 0,
|
||||
.readonly = true,
|
||||
},
|
||||
@ -1924,4 +1924,4 @@ struct db_query db_postgres_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:3c0924d3409c1d356d9f90291ae54895d85f34c6a3a42388ad4fb6bfbf13820d
|
||||
// SHA256STAMP:8f8494fdeb030b724d84aa26c0377e7e488ad40e4b1370db7d02470ac29c4ec8
|
||||
|
6
wallet/db_sqlite3_sqlgen.c
generated
6
wallet/db_sqlite3_sqlgen.c
generated
@ -1131,8 +1131,8 @@ struct db_query db_sqlite3_queries[] = {
|
||||
.readonly = false,
|
||||
},
|
||||
{
|
||||
.name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features FROM invoices ORDER BY id;",
|
||||
.query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features FROM invoices ORDER BY id;",
|
||||
.name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;",
|
||||
.query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;",
|
||||
.placeholders = 0,
|
||||
.readonly = true,
|
||||
},
|
||||
@ -1924,4 +1924,4 @@ struct db_query db_sqlite3_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:3c0924d3409c1d356d9f90291ae54895d85f34c6a3a42388ad4fb6bfbf13820d
|
||||
// SHA256STAMP:8f8494fdeb030b724d84aa26c0377e7e488ad40e4b1370db7d02470ac29c4ec8
|
||||
|
@ -455,6 +455,7 @@ bool invoices_iterate(struct invoices *invoices,
|
||||
", bolt11"
|
||||
", description"
|
||||
", features"
|
||||
", local_offer_id"
|
||||
" FROM invoices"
|
||||
" ORDER BY id;"));
|
||||
db_query_prepared(stmt);
|
||||
|
14
wallet/statements_gettextgen.po
generated
14
wallet/statements_gettextgen.po
generated
@ -747,26 +747,26 @@ msgid "DELETE FROM invoices WHERE state = ? AND expiry_time <= ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:445
|
||||
msgid "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features FROM invoices ORDER BY id;"
|
||||
msgid "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:502
|
||||
#: wallet/invoices.c:503
|
||||
msgid "SELECT state FROM invoices WHERE id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:520
|
||||
#: wallet/invoices.c:521
|
||||
msgid "SELECT local_offer_id FROM invoices WHERE id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:552
|
||||
#: wallet/invoices.c:553
|
||||
msgid "UPDATE invoices SET state=? , pay_index=? , msatoshi_received=? , paid_timestamp=? WHERE id=?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:611
|
||||
#: wallet/invoices.c:612
|
||||
msgid "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > ? ORDER BY pay_index ASC LIMIT 1;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/invoices.c:660
|
||||
#: wallet/invoices.c:661
|
||||
msgid "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = ?;"
|
||||
msgstr ""
|
||||
|
||||
@ -1269,4 +1269,4 @@ msgstr ""
|
||||
#: wallet/test/run-wallet.c:1649
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:913e7b10afc4160e8b437a2c54839d996a94667fc0c00a22f3ca97856491ac72
|
||||
# SHA256STAMP:cc1be3f6b134130e9c0251467bd7ecb8a7cdb20f3026bdd26fcf5b286872ef2c
|
||||
|
Loading…
Reference in New Issue
Block a user