bkpr: turns out these fields are optional

pushes and channel leases don't provide fees or payment_id info
This commit is contained in:
niftynei 2022-07-19 17:04:35 +09:30 committed by Rusty Russell
parent 899d54edd0
commit 8ec35b7eb1

View file

@ -324,23 +324,23 @@ static const char *parse_and_log_channel_move(struct command *cmd,
const char *err;
err = json_scan(tmpctx, buf, params,
"{coin_movement:"
"{payment_hash:%"
",fees:%"
"}}",
JSON_SCAN(json_to_sha256, &e->payment_id),
JSON_SCAN(json_to_msat, &e->fees));
"{coin_movement:{payment_hash:%}}",
JSON_SCAN(json_to_sha256, &e->payment_id));
if (err)
return err;
memset(&e->payment_id, 0, sizeof(struct sha256));
err = json_scan(tmpctx, buf, params,
"{coin_movement:"
"{part_id:%}}",
"{coin_movement:{part_id:%}}",
JSON_SCAN(json_to_number, &e->part_id));
if (err)
e->part_id = 0;
err = json_scan(tmpctx, buf, params,
"{coin_movement:{fees_msat:%}}",
JSON_SCAN(json_to_msat, &e->fees));
if (err)
e->fees = AMOUNT_MSAT(0);
e->credit = credit;
e->debit = debit;
e->currency = tal_steal(e, coin_type);