mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
lightningd: create new return code for enableoffer.
Suggested-by: https://github.com/Lagrang3 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1e1edfd073
commit
975dd76086
@ -112,6 +112,7 @@ enum jsonrpc_errcode {
|
||||
OFFER_ROUTE_NOT_FOUND = 1003,
|
||||
OFFER_BAD_INVREQ_REPLY = 1004,
|
||||
OFFER_TIMEOUT = 1005,
|
||||
OFFER_ALREADY_ENABLED = 1006,
|
||||
|
||||
/* Errors from datastore command */
|
||||
DATASTORE_DEL_DOES_NOT_EXIST = 1200,
|
||||
|
@ -10998,6 +10998,12 @@
|
||||
"Note: the returned object is the same format as **listoffers**."
|
||||
]
|
||||
},
|
||||
"errors": [
|
||||
"On failure, one of the following error codes may be returned:",
|
||||
"",
|
||||
"- -32602: Error in given parameters.",
|
||||
"- 1006: offer already enabled."
|
||||
],
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
||||
],
|
||||
|
@ -74,6 +74,12 @@
|
||||
"Note: the returned object is the same format as **listoffers**."
|
||||
]
|
||||
},
|
||||
"errors": [
|
||||
"On failure, one of the following error codes may be returned:",
|
||||
"",
|
||||
"- -32602: Error in given parameters.",
|
||||
"- 1006: offer already enabled."
|
||||
],
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
||||
],
|
||||
|
@ -253,7 +253,7 @@ static struct command_result *json_enableoffer(struct command *cmd,
|
||||
return command_fail(cmd, LIGHTNINGD, "Unknown offer");
|
||||
|
||||
if (offer_status_active(status))
|
||||
return command_fail(cmd, OFFER_ALREADY_DISABLED,
|
||||
return command_fail(cmd, OFFER_ALREADY_ENABLED,
|
||||
"offer already active");
|
||||
|
||||
if (command_check_only(cmd))
|
||||
|
@ -5990,7 +5990,7 @@ def test_enableoffer(node_factory):
|
||||
l1.rpc.fetchinvoice(offer=offer1['bolt12'])
|
||||
|
||||
# Can't enable twice.
|
||||
with pytest.raises(RpcError, match="1001.*offer already active"):
|
||||
with pytest.raises(RpcError, match="1006.*offer already active"):
|
||||
l2.rpc.enableoffer(offer_id=offer1['offer_id'])
|
||||
|
||||
# Can't enable unknown.
|
||||
|
Loading…
Reference in New Issue
Block a user