Skip to content

Commit

Permalink
Merge #824: qa: fix flaky test of unconfirmed spend RBF
Browse files Browse the repository at this point in the history
6b5fc2d 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 6b5fc2d -- trivial and i've run this test a few dozen times concurrently locally to make sure it's unflaked.

Tree-SHA512: 7470a1fd4c16ee7af6ee4c9d9e57271f5f18ac728062cc937a366681534714ec404f2b8e0a58e0d5f51a7461e28dcae6d93f49e5fc0f45297eae9b979e821f86
  • Loading branch information
darosior committed Nov 20, 2023
2 parents 38b851e + 6b5fc2d commit f512f3c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f512f3c

Please sign in to comment.