From 3482d254e30fab9869daf65af9f6fdc5c956bd42 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 19 Nov 2019 15:26:09 +0100 Subject: [PATCH] pytest: Fix a test assuming a specific DB order Postgresql does not guarantee insertion order when querying, so we need to actually go and look for the correct transaction. Signed-off-by: Christian Decker --- tests/test_wallet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 404adeabe..3e1bc1349 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -676,5 +676,6 @@ def test_fundchannel_listtransaction(node_factory, bitcoind): # next call warned about SQL Accessing a null column # and crashed the daemon for accessing random memory or null txs = l1.rpc.listtransactions()['transactions'] - assert txs[0]['hash'] == txid - assert txs[0]['blockheight'] == 0 + + tx = [t for t in txs if t['hash'] == txid][0] + assert tx['blockheight'] == 0