diff --git a/common/jsonrpc_errors.h b/common/jsonrpc_errors.h index 9a19d0f2db01..ca69a9bfc0d9 100644 --- a/common/jsonrpc_errors.h +++ b/common/jsonrpc_errors.h @@ -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, diff --git a/contrib/msggen/msggen/schema.json b/contrib/msggen/msggen/schema.json index 6a8afdcc5b95..04085f206044 100644 --- a/contrib/msggen/msggen/schema.json +++ b/contrib/msggen/msggen/schema.json @@ -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 <> is mainly responsible." ], diff --git a/doc/schemas/lightning-enableoffer.json b/doc/schemas/lightning-enableoffer.json index fd6dee52747f..1970df3c335c 100644 --- a/doc/schemas/lightning-enableoffer.json +++ b/doc/schemas/lightning-enableoffer.json @@ -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 <> is mainly responsible." ], diff --git a/lightningd/offer.c b/lightningd/offer.c index faf892a52e66..e5a88e9872d9 100644 --- a/lightningd/offer.c +++ b/lightningd/offer.c @@ -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)) diff --git a/tests/test_pay.py b/tests/test_pay.py index 2c4b667dbd9f..296750e69316 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -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.