Skip to content

Commit 4517435

Browse files
rustyrussellcdecker
authored andcommitted
pytest: fix flake in tests/test_pay.py::test_pay_exclude_node
``` # Excludes channel, then ignores routehint which includes that, then # it excludes other channel. > assert len(status) == 2 E assert 1 == 2 E -1 E +2 ``` The invoice we use at the end has a routehint: 50% of the time it's to l2 (which fails), 50% to l5 (which succeeds). Change it to create invoice before channel with l5 so it does the retry like we expect here. Signed-off-by: Rusty Russell <[email protected]>
1 parent 14d08b7 commit 4517435

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_pay.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def test_pay_exclude_node(node_factory, bitcoind):
161161
assert status[0]['failure']['data']['failcodename'] == 'WIRE_TEMPORARY_NODE_FAILURE'
162162
assert 'failure' in status[1]
163163

164+
# Get a fresh invoice, but do it before other routes exist, so routehint
165+
# will be via l2.
166+
inv = l3.rpc.invoice(amount, "test2", 'description')['bolt11']
167+
assert only_one(l1.rpc.decodepay(inv)['routes'])[0]['pubkey'] == l2.info['id']
168+
164169
# l1->l4->l5->l3 is the longer route. This makes sure this route won't be
165170
# tried for the first pay attempt. Just to be sure we also raise the fees
166171
# that l4 leverages.
@@ -187,8 +192,6 @@ def test_pay_exclude_node(node_factory, bitcoind):
187192
r'update for channel {}/1 now ACTIVE'
188193
.format(scid53)])
189194

190-
inv = l3.rpc.invoice(amount, "test2", 'description')['bolt11']
191-
192195
# This `pay` will work
193196
l1.rpc.pay(inv)
194197

0 commit comments

Comments
 (0)