Skip to content

Commit

Permalink
pay: Fix final TLV payload if not going through MPP modifiers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cdecker authored and ZmnSCPxj committed Aug 9, 2020
1 parent a34ec5a commit fb24e00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plugins/libplugin-pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,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
Expand Down Expand Up @@ -1107,8 +1108,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;
}
Expand Down
1 change: 0 additions & 1 deletion tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,6 @@ def test_listpay_result_with_paymod(node_factory, bitcoind):
assert 'destination' in l2.rpc.listpays()['pays'][0]


@pytest.mark.xfail(strict=True)
@unittest.skipIf(not DEVELOPER, "needs use_shadow")
def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor):
'''
Expand Down

0 comments on commit fb24e00

Please sign in to comment.