From 0c3aa355dbf64f1554b32077196419d794dad0ee Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 28 Mar 2022 12:54:29 +1030 Subject: [PATCH] tests: add test that pay gets update correct. This is the part which works: we have another old PR (or simply uncomment the FIXME section) for the routehint case. Closes: #4781 See-also: #4808 Signed-off-by: Rusty Russell --- tests/test_pay.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/test_pay.py b/tests/test_pay.py index d55dade1de5e..1a4c23f50419 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -312,6 +312,40 @@ def test_pay_get_error_with_update(node_factory): wait_for(lambda: not l1.is_channel_active(chanid2)) +@pytest.mark.developer("needs DEVELOPER=1 for dev_suppress_gossip, dev-routes") +def test_pay_error_update_fees(node_factory): + """We should process an update inside a temporary_channel_failure""" + l1, l2, l3 = node_factory.line_graph(3, fundchannel=True, wait_for_announce=True) + + # Don't include any routehints in first invoice. + inv1 = l3.rpc.call('invoice', + {'msatoshi': 123000, + 'label': 'test_pay_error_update_fees', + 'description': 'description', + 'dev-routes': []}) + + inv2 = l3.rpc.invoice(123000, 'test_pay_error_update_fees2', 'desc') # noqa: F841 + + # Make sure l2 doesn't tell l1 directly that channel fee is changed. + l2.rpc.dev_suppress_gossip() + l2.rpc.setchannel(l3.info['id'], 1337, 137, enforcedelay=0) + + # Should bounce off and retry... + l1.rpc.pay(inv1['bolt11']) + attempts = only_one(l1.rpc.paystatus(inv1['bolt11'])['pay'])['attempts'] + assert len(attempts) == 2 + # WIRE_FEE_INSUFFICIENT = UPDATE|12 + assert attempts[0]['failure']['data']['failcode'] == 4108 + + # FIXME: We *DO NOT* handle misleading routehints! + # # Should ignore old routehint and do the same... + # l1.rpc.pay(inv2['bolt11']) + # attempts = only_one(l1.rpc.paystatus(inv2['bolt11'])['pay'])['attempts'] + # assert len(attempts) == 2 + # # WIRE_FEE_INSUFFICIENT = UPDATE|12 + # assert attempts[0]['failure']['data']['failcode'] == 4108 + + @pytest.mark.developer("needs to deactivate shadow routing") def test_pay_optional_args(node_factory, compat): l1, l2 = node_factory.line_graph(2)