mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
paymod: Don't assume that the first payment was executed at all
With the `presplit`-modifier we actually skip execution of the root altogether which results in the root not having a result at all. Instead we should use the result returned by `payment_collect_result`.
This commit is contained in:
parent
f6745682c3
commit
3f399d15cb
1 changed files with 6 additions and 6 deletions
|
@ -1105,22 +1105,22 @@ static void payment_finished(struct payment *p)
|
||||||
} else {
|
} else {
|
||||||
struct payment_result *failure = result.failure;
|
struct payment_result *failure = result.failure;
|
||||||
assert(failure!= NULL);
|
assert(failure!= NULL);
|
||||||
ret = jsonrpc_stream_fail(cmd, p->result->code,
|
ret = jsonrpc_stream_fail(cmd, failure->code,
|
||||||
failure->message);
|
failure->message);
|
||||||
|
|
||||||
json_add_u64(ret, "id", p->result->id);
|
json_add_u64(ret, "id", failure->id);
|
||||||
|
|
||||||
json_add_u32(ret, "failcode", result.failure->failcode);
|
json_add_u32(ret, "failcode", failure->failcode);
|
||||||
json_add_string(ret, "failcodename",
|
json_add_string(ret, "failcodename",
|
||||||
result.failure->failcodename);
|
failure->failcodename);
|
||||||
|
|
||||||
if (p->bolt11)
|
if (p->bolt11)
|
||||||
json_add_string(ret, "bolt11", p->bolt11);
|
json_add_string(ret, "bolt11", p->bolt11);
|
||||||
|
|
||||||
json_add_hex_talarr(ret, "raw_message",
|
json_add_hex_talarr(ret, "raw_message",
|
||||||
p->result->raw_message);
|
result.failure->raw_message);
|
||||||
json_add_num(ret, "created_at", p->start_time.ts.tv_sec);
|
json_add_num(ret, "created_at", p->start_time.ts.tv_sec);
|
||||||
json_add_string(ret, "message", p->result->message);
|
json_add_string(ret, "message", result.failure->message);
|
||||||
json_add_node_id(ret, "destination", p->destination);
|
json_add_node_id(ret, "destination", p->destination);
|
||||||
json_add_sha256(ret, "payment_hash", p->payment_hash);
|
json_add_sha256(ret, "payment_hash", p->payment_hash);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue