pytest: Let fail_htlcs.py plugin generates TEMPORARY_NODE_FAILURE error

This commit is contained in:
trueptolemy
2019-09-05 22:43:07 +08:00
committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent 22e8d242fc
commit a3a0f651e3
2 changed files with 13 additions and 5 deletions

View File

@@ -426,10 +426,16 @@ def test_htlc_accepted_hook_fail(node_factory):
], wait_for_announce=True)
# This must fail
inv = l2.rpc.invoice(1000, "lbl", "desc")['bolt11']
phash = l2.rpc.invoice(1000, "lbl", "desc")['payment_hash']
route = l1.rpc.getroute(l2.info['id'], 1000, 1)['route']
# Here shouldn't use `pay` command because l2 rejects with WIRE_TEMPORARY_NODE_FAILURE,
# then it will be excluded when l1 try another pay attempt.
# Note if the destination is excluded, the route result is undefined.
l1.rpc.sendpay(route, phash)
with pytest.raises(RpcError) as excinfo:
l1.rpc.pay(inv)
assert excinfo.value.error['data']['failcode'] == 16399
l1.rpc.waitsendpay(phash)
assert excinfo.value.error['data']['failcode'] == 0x2002
assert excinfo.value.error['data']['erring_index'] == 1
# And the invoice must still be unpaid
@@ -439,7 +445,7 @@ def test_htlc_accepted_hook_fail(node_factory):
# Now try with forwarded HTLCs: l2 should still fail them
# This must fail
inv = l3.rpc.invoice(1000, "lbl", "desc")['bolt11']
with pytest.raises(RpcError) as excinfo:
with pytest.raises(RpcError):
l1.rpc.pay(inv)
# And the invoice must still be unpaid