Browse Source

pay: Fix final TLV payload if not going through MPP modifiers

Reported-by: ZmnSCPxj
Signed-off-by: Christian Decker <@cdecker>

Changelog-Fixed: pay: Correct a case where we put the sub-payment value instead of the *total* value in the `total_msat` field of a multi-part payment.
bump-pyln-proto
Christian Decker 5 years ago
parent
commit
8769f9ed93
  1. 6
      plugins/libplugin-pay.c
  2. 1
      tests/test_pay.py

6
plugins/libplugin-pay.c

@ -1076,6 +1076,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
u32 cltv = p->start_block + next->delay + 1;
u64 msat = next->amount.millisatoshis; /* Raw: TLV payload generation*/
struct tlv_field **fields;
struct payment *root = payment_root(p);
static struct short_channel_id all_zero_scid = {.u64 = 0};
/* This is the information of the node processing this payload, while
@ -1111,8 +1112,9 @@ static void payment_add_hop_onion_payload(struct payment *p,
if (payment_secret != NULL) {
assert(final);
tlvstream_set_tlv_payload_data(fields, payment_secret,
msat);
tlvstream_set_tlv_payload_data(
fields, payment_secret,
root->amount.millisatoshis); /* Raw: TLV payload generation*/
}
break;
}

1
tests/test_pay.py

@ -3308,7 +3308,6 @@ def test_listpays_ongoing_attempt(node_factory, bitcoind, executor):
l1.rpc.listpays()
@pytest.mark.xfail(strict=True)
@unittest.skipIf(not DEVELOPER, "needs use_shadow")
def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor):
'''

Loading…
Cancel
Save