diff --git a/doc/lightning-delinvoice.7 b/doc/lightning-delinvoice.7 index 17911a8a3..6aeaa82c4 100644 --- a/doc/lightning-delinvoice.7 +++ b/doc/lightning-delinvoice.7 @@ -93,4 +93,4 @@ Rusty Russell \fI is mainly responsible\. Main web site: \fIhttps://github.com/ElementsProject/lightning\fR -\" SHA256STAMP:ff36afbf0c8f27efd0c6e82f32ba783e511f53f5978342b210ba78038c1934bf +\" SHA256STAMP:59f9becf74ee1b70ad9eb4316baaed1d26a95e34c3a5000e095fc8b7bfa291cf diff --git a/doc/lightning-delinvoice.7.md b/doc/lightning-delinvoice.7.md index 98cc088f1..5b3cb5db9 100644 --- a/doc/lightning-delinvoice.7.md +++ b/doc/lightning-delinvoice.7.md @@ -71,4 +71,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:6435d88007d1b21e97c969cc202e240ed57df572a3312a6b77ea66ed3a8d512a) +[comment]: # ( SHA256STAMP:62a3bdd502ed0b3b555f3cfda6a0e5f7c2417ce0f5b23202d613216de58a23f3) diff --git a/doc/lightning-listinvoices.7 b/doc/lightning-listinvoices.7 index 8e5c03519..d7de29ee2 100644 --- a/doc/lightning-listinvoices.7 +++ b/doc/lightning-listinvoices.7 @@ -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 is mainly responsible\. Main web site: \fIhttps://github.com/ElementsProject/lightning\fR -\" SHA256STAMP:1ac6fb88dc05d683e81dc951a593d88027310b9c62dd81c57e134238994b0562 +\" SHA256STAMP:d6bc8b6c09aee1f5e29900fffacbc9d3fdf1e32d27e7b90b0709a5f50ecb5c13 diff --git a/doc/lightning-listinvoices.7.md b/doc/lightning-listinvoices.7.md index 5f772cdda..a6e1fd908 100644 --- a/doc/lightning-listinvoices.7.md +++ b/doc/lightning-listinvoices.7.md @@ -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: -[comment]: # ( SHA256STAMP:67ff5d9aa945301f23d6694304e4b657a37f0b3f80cc1c13c2ff23a55fe51d4b) +[comment]: # ( SHA256STAMP:cc6d7b4549d2ab905ab18041f34d13143e4ffed2bb6cc7c1df0307800e59a2fa) diff --git a/doc/schemas/delinvoice.schema.json b/doc/schemas/delinvoice.schema.json index f5482206a..4840d4610 100644 --- a/doc/schemas/delinvoice.schema.json +++ b/doc/schemas/delinvoice.schema.json @@ -111,6 +111,7 @@ "amount_msat": { }, "description": { }, "payment_hash": { }, + "local_offer_id": { }, "pay_index": { "type": "u64", "description": "unique index for this invoice payment" diff --git a/doc/schemas/listinvoices.schema.json b/doc/schemas/listinvoices.schema.json index 6c5ffa654..a2edbeb7f 100644 --- a/doc/schemas/listinvoices.schema.json +++ b/doc/schemas/listinvoices.schema.json @@ -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": { } } } diff --git a/tests/test_pay.py b/tests/test_pay.py index ed22cbefa..747496a03 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -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 diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index 6d69b9e80..894beaf35 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -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 diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 945e44085..d02ed9fba 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -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 diff --git a/wallet/invoices.c b/wallet/invoices.c index e5e51ea68..9314defa5 100644 --- a/wallet/invoices.c +++ b/wallet/invoices.c @@ -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); diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index f750b00a6..44339e8eb 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -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