diff options
author | Antoine Poinsot <darosior@protonmail.com> | 2021-10-15 12:29:27 +0200 |
---|---|---|
committer | Antoine Poinsot <darosior@protonmail.com> | 2021-12-09 15:11:35 +0100 |
commit | e50213967b6d5dda9c0acc4643c8ec67f9fd7284 (patch) | |
tree | 5953a6be4c2cf3cdfc9584bd492113eb8919db6d /test/functional/feature_fee_estimation.py | |
parent | 15f5fd62afb57ec501dc8c6706999d4c83e58414 (diff) | |
download | bitcoin-e50213967b6d5dda9c0acc4643c8ec67f9fd7284.tar.xz |
qa: fee estimation with RBF test cleanups
Followups to #22539
Co-Authored-By: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Diffstat (limited to 'test/functional/feature_fee_estimation.py')
-rwxr-xr-x | test/functional/feature_fee_estimation.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 8a8e91b2aa..937a4050cf 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -131,16 +131,15 @@ def check_estimates(node, fees_seen): def send_tx(node, utxo, feerate): """Broadcast a 1in-1out transaction with a specific input and feerate (sat/vb).""" - overhead, op, scriptsig, nseq, value, spk = 10, 36, 5, 4, 8, 24 - tx_size = overhead + op + scriptsig + nseq + value + spk - fee = tx_size * feerate - tx = CTransaction() tx.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), REDEEM_SCRIPT)] - tx.vout = [CTxOut(int(utxo["amount"] * COIN) - fee, P2SH)] - txid = node.sendrawtransaction(tx.serialize().hex()) + tx.vout = [CTxOut(int(utxo["amount"] * COIN), P2SH)] + + # vbytes == bytes as we are using legacy transactions + fee = tx.get_vsize() * feerate + tx.vout[0].nValue -= fee - return txid + return node.sendrawtransaction(tx.serialize().hex()) class EstimateFeeTest(BitcoinTestFramework): @@ -297,12 +296,9 @@ class EstimateFeeTest(BitcoinTestFramework): miner.prioritisetransaction(txid=txid, fee_delta=-COIN) self.generate(miner, 1) # RBF the low-fee transactions - while True: - try: - u = utxos_to_respend.pop(0) - send_tx(node, u, high_feerate) - except IndexError: - break + while len(utxos_to_respend) > 0: + u = utxos_to_respend.pop(0) + send_tx(node, u, high_feerate) # Mine the last replacement txs self.sync_mempools(wait=0.1, nodes=[node, miner]) |