Skip to content

Commit 099a7ec

Browse files
rustyrussellShahanaFarooqui
authored andcommitted
pytest: fix flake in test_xpay_twohop_bug
CLTV can be one less if l1 hasn't seen block yet: ``` 2025-04-24T05:38:12.8587408Z > l1.daemon.wait_for_log(f'Adding HTLC 0 amount=15002msat cltv={110 + 1 + 100 + 200 + 400}') 2025-04-24T05:38:12.8587715Z 2025-04-24T05:38:12.8587804Z tests/test_xpay.py:824: ... 2025-04-24T05:38:12.9889506Z lightningd-1 2025-04-24T05:30:45.255Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: Adding HTLC 0 amount=15002msat cltv=812 gave CHANNEL_ERR_ADD_OK ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 2c57347 commit 099a7ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_xpay.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from pyln.client import RpcError
44
from pyln.testing.utils import FUNDAMOUNT, only_one
55
from utils import (
6-
TIMEOUT, first_scid, GenChannel, generate_gossip_store, wait_for
6+
TIMEOUT, first_scid, GenChannel, generate_gossip_store, wait_for,
7+
sync_blockheight,
78
)
89

910
import os
@@ -776,7 +777,7 @@ def test_fail_after_success(node_factory, bitcoind, executor, slow_mode):
776777
'successful_parts': 1}
777778

778779

779-
def test_xpay_twohop_bug(node_factory):
780+
def test_xpay_twohop_bug(node_factory, bitcoind):
780781
"""From https://github.com/ElementsProject/lightning/issues/8119:
781782
Oh, interesting! I tried again and got a two-hop blinded path. xpay returned the same error you saw while pay was successful.
782783
@@ -818,6 +819,9 @@ def test_xpay_twohop_bug(node_factory):
818819
assert len(path['path']) == 2
819820
assert path['payinfo']['cltv_expiry_delta'] == 200 + 400
820821

822+
# Make sure l1 is on correct height, so CLTV is as expected.
823+
sync_blockheight(bitcoind, [l1])
824+
821825
# This works.
822826
l1.rpc.pay(inv)
823827
# CLTV is blockheight (110) + 1 + 100 + 200 + 400

0 commit comments

Comments
 (0)