mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
disableoffer: fix disabling of already-used offers.
Turns out we didn't actually test this at all, and next commit does :( offer_status_in_db: 4 is invalid lightningd: FATAL SIGNAL 6 (version v0.10.0-459-g48fbd45-modded) 0x5608cd360855 send_backtrace common/daemon.c:39 0x5608cd3608ff crashdump common/daemon.c:52 0x7f9af1dae20f ??? ???:0 0x7f9af1dae18b ??? ???:0 0x7f9af1d8d858 ??? ???:0 0x5608cd30a47e fatal lightningd/log.c:819 0x5608cd3430c5 offer_status_in_db wallet/wallet.h:1424 0x5608cd34f1f3 wallet_offer_disable wallet/wallet.c:4494 0x5608cd33ae2e json_disableoffer lightningd/offer.c:256 0x5608cd3038fc command_exec lightningd/jsonrpc.c:643 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
57cc4e3c34
commit
44c469d52b
8 changed files with 13 additions and 9 deletions
4
doc/lightning-disableoffer.7
generated
4
doc/lightning-disableoffer.7
generated
|
@ -42,7 +42,7 @@ On success, an object is returned, containing:
|
|||
.IP \[bu]
|
||||
\fBoffer_id\fR (hex): the merkle hash of the offer (always 64 characters)
|
||||
.IP \[bu]
|
||||
\fBactive\fR (boolean): Whether the offer can produce invoices/payments (always "false")
|
||||
\fBactive\fR (boolean): Whether the offer can produce invoices/payments (always \fIfalse\fR)
|
||||
.IP \[bu]
|
||||
\fBsingle_use\fR (boolean): Whether the offer is disabled after first successful use
|
||||
.IP \[bu]
|
||||
|
@ -80,4 +80,4 @@ Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
|
|||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:2383f44a3bcc1023d6619f5ead4c27d7b2bd9a52bd64d00142fd26658a49dd32
|
||||
\" SHA256STAMP:e905cb7b8acef73c3ca6bbd41d861234b006aa28185c46b6ba1419c4a0065c3a
|
||||
|
|
|
@ -37,7 +37,7 @@ Note: the returned object is the same format as **listoffers**.
|
|||
[comment]: # (GENERATE-FROM-SCHEMA-START)
|
||||
On success, an object is returned, containing:
|
||||
- **offer_id** (hex): the merkle hash of the offer (always 64 characters)
|
||||
- **active** (boolean): Whether the offer can produce invoices/payments (always "false")
|
||||
- **active** (boolean): Whether the offer can produce invoices/payments (always *false*)
|
||||
- **single_use** (boolean): Whether the offer is disabled after first successful use
|
||||
- **bolt12** (string): The bolt12 string representing this offer
|
||||
- **bolt12_unsigned** (string): The bolt12 string representing this offer, without signature
|
||||
|
@ -73,4 +73,4 @@ RESOURCES
|
|||
---------
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
[comment]: # ( SHA256STAMP:5b96eca3e35f6c556b93db1743c617b59e69058c9421ece9cc99a9c8814c176b)
|
||||
[comment]: # ( SHA256STAMP:8f0595c22a7684d99da3000cc19b2465991fa1d2ee435a395b7a1527330aa490)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"active": {
|
||||
"type": "boolean",
|
||||
"enum": [ "false" ],
|
||||
"enum": [ false ],
|
||||
"description": "Whether the offer can produce invoices/payments"
|
||||
},
|
||||
"single_use": {
|
||||
|
|
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
|
@ -2026,4 +2026,4 @@ struct db_query db_postgres_queries[] = {
|
|||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:020ef91a3637bbe29c82477083389a5ecaf359ae049940017ec5c76609c08fdc
|
||||
// SHA256STAMP:6353b67b3e4f539da2d1f0c2564c4a8243f07d59cd0b73bc83d5552600bd67f7
|
||||
|
|
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
|
@ -2026,4 +2026,4 @@ struct db_query db_sqlite3_queries[] = {
|
|||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:020ef91a3637bbe29c82477083389a5ecaf359ae049940017ec5c76609c08fdc
|
||||
// SHA256STAMP:6353b67b3e4f539da2d1f0c2564c4a8243f07d59cd0b73bc83d5552600bd67f7
|
||||
|
|
2
wallet/statements_gettextgen.po
generated
2
wallet/statements_gettextgen.po
generated
|
@ -1337,4 +1337,4 @@ msgstr ""
|
|||
#: wallet/test/run-wallet.c:1696
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:c273019025094b8ac8311eb7a8489207006506ca46a1963c5924e1947e4c60d5
|
||||
# SHA256STAMP:e203d19d9f4192ad6b3aa1a6f257d4f7b267df56c5de9810b573f0affa0122fd
|
||||
|
|
|
@ -4666,7 +4666,7 @@ enum offer_status wallet_offer_disable(struct wallet *w,
|
|||
|
||||
assert(offer_status_active(s));
|
||||
|
||||
newstatus = offer_status_in_db(s &= ~OFFER_STATUS_ACTIVE_F);
|
||||
newstatus = offer_status_in_db(s & ~OFFER_STATUS_ACTIVE_F);
|
||||
offer_status_update(w->db, offer_id, s, newstatus);
|
||||
|
||||
return newstatus;
|
||||
|
|
|
@ -1398,6 +1398,7 @@ enum offer_status {
|
|||
OFFER_SINGLE_USE_UNUSED = OFFER_STATUS_ACTIVE_F|OFFER_STATUS_SINGLE_F,
|
||||
OFFER_SINGLE_USE_USED = OFFER_STATUS_SINGLE_F|OFFER_STATUS_USED_F,
|
||||
OFFER_SINGLE_DISABLED = OFFER_STATUS_SINGLE_F,
|
||||
OFFER_MULTIPLE_USED_DISABLED = OFFER_STATUS_USED_F,
|
||||
OFFER_MULTIPLE_DISABLED = 0,
|
||||
};
|
||||
|
||||
|
@ -1419,6 +1420,9 @@ static inline enum offer_status offer_status_in_db(enum offer_status s)
|
|||
case OFFER_SINGLE_DISABLED:
|
||||
BUILD_ASSERT(OFFER_SINGLE_DISABLED == 2);
|
||||
return s;
|
||||
case OFFER_MULTIPLE_USED_DISABLED:
|
||||
BUILD_ASSERT(OFFER_MULTIPLE_USED_DISABLED == 4);
|
||||
return s;
|
||||
case OFFER_MULTIPLE_DISABLED:
|
||||
BUILD_ASSERT(OFFER_MULTIPLE_DISABLED == 0);
|
||||
return s;
|
||||
|
|
Loading…
Add table
Reference in a new issue