Skip to content

Commit e502139

Browse files
darosiortheStack
andcommitted
qa: fee estimation with RBF test cleanups
Followups to #22539 Co-Authored-By: Sebastian Falbesoner <[email protected]>
1 parent 15f5fd6 commit e502139

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

test/functional/feature_fee_estimation.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,15 @@ def check_estimates(node, fees_seen):
131131

132132
def send_tx(node, utxo, feerate):
133133
"""Broadcast a 1in-1out transaction with a specific input and feerate (sat/vb)."""
134-
overhead, op, scriptsig, nseq, value, spk = 10, 36, 5, 4, 8, 24
135-
tx_size = overhead + op + scriptsig + nseq + value + spk
136-
fee = tx_size * feerate
137-
138134
tx = CTransaction()
139135
tx.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), REDEEM_SCRIPT)]
140-
tx.vout = [CTxOut(int(utxo["amount"] * COIN) - fee, P2SH)]
141-
txid = node.sendrawtransaction(tx.serialize().hex())
136+
tx.vout = [CTxOut(int(utxo["amount"] * COIN), P2SH)]
137+
138+
# vbytes == bytes as we are using legacy transactions
139+
fee = tx.get_vsize() * feerate
140+
tx.vout[0].nValue -= fee
142141

143-
return txid
142+
return node.sendrawtransaction(tx.serialize().hex())
144143

145144

146145
class EstimateFeeTest(BitcoinTestFramework):
@@ -297,12 +296,9 @@ def sanity_check_rbf_estimates(self, utxos):
297296
miner.prioritisetransaction(txid=txid, fee_delta=-COIN)
298297
self.generate(miner, 1)
299298
# RBF the low-fee transactions
300-
while True:
301-
try:
302-
u = utxos_to_respend.pop(0)
303-
send_tx(node, u, high_feerate)
304-
except IndexError:
305-
break
299+
while len(utxos_to_respend) > 0:
300+
u = utxos_to_respend.pop(0)
301+
send_tx(node, u, high_feerate)
306302

307303
# Mine the last replacement txs
308304
self.sync_mempools(wait=0.1, nodes=[node, miner])

0 commit comments

Comments
 (0)