Merge #824: qa: fix flaky test of unconfirmed spend RBF

6b5fc2d1faf94d8290a30bd7007113815c8936ea qa: fix flaky test of unconfirmed spend RBF (Antoine Poinsot)

Pull request description:

  Since #617 the spend info for a coin may be wiped from the DB. Be robust to a temporarily `None` spend info in the functional test.

  See for instance https://github.com/wizardsardine/liana/runs/18785511349.

ACKs for top commit:
  darosior:
    ACK 6b5fc2d1faf94d8290a30bd7007113815c8936ea -- trivial and i've run this test a few dozen times concurrently locally to make sure it's unflaked.

Tree-SHA512: 7470a1fd4c16ee7af6ee4c9d9e57271f5f18ac728062cc937a366681534714ec404f2b8e0a58e0d5f51a7461e28dcae6d93f49e5fc0f45297eae9b979e821f86
This commit is contained in:
Antoine Poinsot 2023-11-20 14:56:20 +01:00
commit f512f3c511
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -397,11 +397,15 @@ def test_conflicting_unconfirmed_spend_txs(lianad, bitcoind):
bitcoind.rpc.sendrawtransaction(tx_hex)
# We must now detect the coin as being spent by the second transaction.
wait_for(
lambda: get_coin(lianad, spent_coin["outpoint"])["spend_info"] is not None
and get_coin(lianad, spent_coin["outpoint"])["spend_info"]["txid"]
== txid_b.hex()
)
def is_spent_by(lianad, outpoint, txid):
coins = lianad.rpc.listcoins([], [outpoint])["coins"]
if len(coins) == 0:
return False
coin = coins[0]
if coin["spend_info"] is None:
return False
return coin["spend_info"]["txid"] == txid.hex()
wait_for(lambda: is_spent_by(lianad, spent_coin["outpoint"], txid_b))
def sign_and_broadcast_psbt(lianad, psbt):