lightningd: fix spurious "more than twice final" error.

Bastien TEINTURIER <bastien@acinq.fr> writes:
> It looks like the split on c-lightning side is quite limited at the moment:
> the only option is to split a payment in exactly its two halves,
> otherwise I get rejected because of the rule of overpaying more than
> twice the amount?

We only tested exactly two equal-size payments; indeed, our finalhop
test was backwards.  We only complain if the final hop pays more than
twice msat (technically, this test is still too loose for mpp: the
spec says we should sum to the exact amount).

Reported-by: @t-bast
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-12-12 10:48:27 +10:30
committed by Christian Decker
parent 7fb4efd98a
commit edab0df611
2 changed files with 12 additions and 12 deletions

View File

@@ -2593,8 +2593,8 @@ def test_partial_payment(node_factory, bitcoind, executor):
paysecret = l4.rpc.decodepay(inv['bolt11'])['payment_secret']
# Separate routes for each part of the payment.
r134 = l1.rpc.getroute(l4.info['id'], 500, 1, exclude=[scid24 + '/0', scid24 + '/1'])['route']
r124 = l1.rpc.getroute(l4.info['id'], 500, 1, exclude=[scid34 + '/0', scid34 + '/1'])['route']
r134 = l1.rpc.getroute(l4.info['id'], 501, 1, exclude=[scid24 + '/0', scid24 + '/1'])['route']
r124 = l1.rpc.getroute(l4.info['id'], 499, 1, exclude=[scid34 + '/0', scid34 + '/1'])['route']
# These can happen in parallel.
l1.rpc.call('sendpay', [r134, inv['payment_hash'], None, 1000, inv['bolt11'], paysecret, 1])
@@ -2638,7 +2638,7 @@ def test_partial_payment(node_factory, bitcoind, executor):
for i in range(2):
line = l4.daemon.wait_for_log('print_htlc_onion.py: Got onion')
assert "'type': 'tlv'" in line
assert "'forward_amount': '500msat'" in line
assert "'forward_amount': '499msat'" in line or "'forward_amount': '501msat'" in line
assert "'total_msat': '1000msat'" in line
assert "'payment_secret': '{}'".format(paysecret) in line