From 2f4c16c38803d25696f7b3cb276f9089c2a64e94 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 13 Aug 2020 13:46:19 +0930 Subject: [PATCH] pytest: fix race in test_bcli. On my test machine, we queried bitcoind before the close tx was sent: ``` # When output is spent, it should give us null ! txo = l1.rpc.call("getutxout", {"txid": txid, "vout": 0}) > assert txo["amount"] is txo["script"] is None E AssertionError: assert '20000000msat' is '00205b8cd3b914cf67cdd8fa6273c930353dd36476734fbd962102c2df53b90880cd' tests/test_plugin.py:1221: AssertionError ``` Signed-off-by: Rusty Russell --- tests/test_plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index e9c49f678..effe22091 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1217,8 +1217,7 @@ def test_bcli(node_factory, bitcoind, chainparams): and txo["script"].startswith("0020")) l1.rpc.close(l2.info["id"]) # When output is spent, it should give us null ! - txo = l1.rpc.call("getutxout", {"txid": txid, "vout": 0}) - assert txo["amount"] is txo["script"] is None + wait_for(lambda: l1.rpc.call("getutxout", {"txid": txid, "vout": 0})['amount'] is None) resp = l1.rpc.call("sendrawtransaction", {"tx": "dummy"}) assert not resp["success"] and "decode failed" in resp["errmsg"]