invoice_hook: remove nested result.
I misunderstood the API, this ended up nesting a result inside the JSON-RPC result. No concerns about backwards compatibility since this is so new. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7f7ad4f89f
commit
ca7864f2f3
|
@ -141,23 +141,17 @@ static bool hook_gives_failcode(const char *buffer,
|
||||||
const jsmntok_t *toks,
|
const jsmntok_t *toks,
|
||||||
enum onion_type *failcode)
|
enum onion_type *failcode)
|
||||||
{
|
{
|
||||||
const jsmntok_t *resulttok, *t;
|
const jsmntok_t *t;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
/* No plugin registered on hook at all? */
|
/* No plugin registered on hook at all? */
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
resulttok = json_get_member(buffer, toks, "result");
|
t = json_get_member(buffer, toks, "failure_code");
|
||||||
if (!resulttok)
|
|
||||||
fatal("Invalid invoice_payment_hook response: %.*s",
|
|
||||||
toks[0].end - toks[1].start, buffer);
|
|
||||||
|
|
||||||
t = json_get_member(buffer, resulttok, "failure_code");
|
|
||||||
if (!t)
|
if (!t)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (!json_to_number(buffer, t, &val))
|
if (!json_to_number(buffer, t, &val))
|
||||||
fatal("Invalid invoice_payment_hook failure_code: %.*s",
|
fatal("Invalid invoice_payment_hook failure_code: %.*s",
|
||||||
toks[0].end - toks[1].start, buffer);
|
toks[0].end - toks[1].start, buffer);
|
||||||
|
|
|
@ -18,9 +18,9 @@ def on_payment(payment, plugin):
|
||||||
if payment['preimage'].endswith('0'):
|
if payment['preimage'].endswith('0'):
|
||||||
# FIXME: Define this!
|
# FIXME: Define this!
|
||||||
WIRE_TEMPORARY_NODE_FAILURE = 0x2002
|
WIRE_TEMPORARY_NODE_FAILURE = 0x2002
|
||||||
return {'result': {'failure_code': WIRE_TEMPORARY_NODE_FAILURE}}
|
return {'failure_code': WIRE_TEMPORARY_NODE_FAILURE}
|
||||||
|
|
||||||
return {'result': {}}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
plugin.run()
|
plugin.run()
|
||||||
|
|
Loading…
Reference in New Issue