Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qa: fee estimation with RBF test cleanups
Browse files Browse the repository at this point in the history
Followups to bitcoin#22539

Co-Atuhored-By: Sebastian Falbesoner <[email protected]>
darosior committed Oct 15, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ca1e21a commit 424f49c
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test/functional/feature_fee_estimation.py
Original file line number Diff line number Diff line change
@@ -131,18 +131,17 @@ 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 = len(tx.serialize()) * feerate
tx.vout[0].nValue -= fee

return txid
return node.sendrawtransaction(tx.serialize().hex())


class EstimateFeeTest(BitcoinTestFramework):
@@ -302,12 +301,9 @@ def sanity_check_rbf_estimates(self, utxos):
self.generate(miner, 1)
self.sync_blocks(wait=0.1, nodes=[node, miner])
# 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])

0 comments on commit 424f49c

Please sign in to comment.