From 26359e4c8c80a707ba597e0a01468faa967e8e94 Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Tue, 18 Feb 2025 13:30:11 -0600 Subject: [PATCH] pytest: address flakes from blinded paths in bolt12 offers Following 6e4ff6a, nodes now check for their public address and generate a blinded path for invoices if the address is not advertized. This breaks several of the tests where the blinded path is expected to have the entrypoint be the node itself. Changelog-None --- tests/test_pay.py | 12 ++++++++---- tests/test_renepay.py | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/test_pay.py b/tests/test_pay.py index 4a9cd0e57..90c050600 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -4438,7 +4438,8 @@ def test_fetchinvoice(node_factory, bitcoind): l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, opts=[{}, {}, - {'broken_log': "plugin-offers: Failed invreq.*Unknown command 'currencyconvert'"}]) + {'broken_log': "plugin-offers: Failed invreq.*Unknown command 'currencyconvert'", + 'dev-allow-localhost': None}]) # Simple offer first. offer1 = l3.rpc.call('offer', {'amount': '2msat', @@ -4534,6 +4535,7 @@ def test_fetchinvoice(node_factory, bitcoind): 'description': 'offer3'}) l4 = node_factory.get_node() l4.rpc.connect(l2.info['id'], 'localhost', l2.port) + time.sleep(0.25) # ... even if we can't find ourselves. l4.rpc.call('fetchinvoice', {'offer': offer3['bolt12']}) # ... even if we know it from gossmap @@ -4585,7 +4587,8 @@ def test_fetchinvoice(node_factory, bitcoind): def test_fetchinvoice_recurrence(node_factory, bitcoind): """Test for our recurrence extension""" - l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True) + l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, + opts=[{}, {'dev-allow-localhost': None}, {}]) # Recurring offer. offer3 = l2.rpc.call('offer', {'amount': '1msat', @@ -6419,9 +6422,10 @@ def test_injectpaymentonion_selfpay(node_factory, executor): def test_injectpaymentonion_blindedpath(node_factory, executor): l1, l2 = node_factory.line_graph(2, - wait_for_announce=True) + wait_for_announce=True, + # avoids trying to create a blinded path to next node + opts=[{}, {'dev-allow-localhost': None}]) blockheight = l1.rpc.getinfo()['blockheight'] - # Test bolt12, with stub blinded path. offer = l2.rpc.offer('any') inv7 = l1.rpc.fetchinvoice(offer['bolt12'], '1000msat') diff --git a/tests/test_renepay.py b/tests/test_renepay.py index a9c12efd2..392cb4bde 100644 --- a/tests/test_renepay.py +++ b/tests/test_renepay.py @@ -52,7 +52,8 @@ def test_shadow_routing(node_factory): Note there is a very low (0.5**10) probability that it fails. """ # We need l3 for random walk - l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True) + l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, + opts={'dev-allow-localhost': None}) amount = 10000 total_amount = 0 @@ -76,7 +77,7 @@ def test_mpp(node_factory): Try paying 1.2M sats from 1 to 6. """ opts = [ - {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0}, + {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0, 'dev-allow-localhost': None}, ] l1, l2, l3, l4, l5, l6 = node_factory.get_nodes(6, opts=opts * 6) node_factory.join_nodes( @@ -843,7 +844,8 @@ def test_description(node_factory): def test_offers(node_factory): - l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True) + l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, + opts={'dev-allow-localhost': None}) offer = l3.rpc.offer("1000sat", "test_renepay_offers")['bolt12'] invoice = l1.rpc.fetchinvoice(offer)['invoice'] response = l1.rpc.call("renepay", {"invstring": invoice})