Skip to content

Commit 08707f8

Browse files
MarcoFalkeknst
authored andcommitted
Merge bitcoin#26517: test: Changed small_txpuzzle_randfee to return the virtual size instead of the transaction hex for feerate calculation.
6fb102c test: Changed small_txpuzzle_randfee to return the virtual size instead of the transaction hex for feerate calculation. (Randall Naar) Pull request description: The fee rates used in feature_fee_estimation.py are calculated using the raw transaction size instead of the virtual transaction size (which is used in 'CBlockPolicyEstimator::processBlockTx' and 'CBlockPolicyEstimator::processBlock'). This leads to inconsistencies as the fee rates used in check_raw_estimates are incorrect and can cause assertions to fail. refs bitcoin#25179 ACKs for top commit: MarcoFalke: ACK 6fb102c Tree-SHA512: b2bca85fffa605aeb17574f050736d4556506d782dd7fd969e165e48e108fd95ef4c4e2abbae83cce05ca777a00f4459cabfa0932694fa8bb93ddfba09d84357
1 parent 12d52b2 commit 08707f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/functional/feature_fee_estimation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def small_txpuzzle_randfee(
6161
unconflist.append({"txid": txid, "vout": 0, "value": total_in - amount - fee})
6262
unconflist.append({"txid": txid, "vout": 1, "value": amount})
6363

64-
return (tx.serialize().hex(), fee)
64+
return (tx.get_vsize(), fee)
6565

6666

6767
def check_raw_estimates(node, fees_seen):
@@ -148,7 +148,7 @@ def transact_and_mine(self, numblocks, mining_node):
148148
random.shuffle(self.confutxo)
149149
for _ in range(random.randrange(100 - 50, 100 + 50)):
150150
from_index = random.randint(1, 2)
151-
(txhex, fee) = small_txpuzzle_randfee(
151+
(tx_bytes, fee) = small_txpuzzle_randfee(
152152
self.wallet,
153153
self.nodes[from_index],
154154
self.confutxo,
@@ -157,7 +157,7 @@ def transact_and_mine(self, numblocks, mining_node):
157157
min_fee,
158158
min_fee,
159159
)
160-
tx_kbytes = (len(txhex) // 2) / 1000.0
160+
tx_kbytes = tx_bytes / 1000.0
161161
self.fees_per_kb.append(float(fee) / tx_kbytes)
162162
self.sync_mempools(wait=0.1)
163163
mined = mining_node.getblock(self.generate(mining_node, 1)[0], True)["tx"]

0 commit comments

Comments
 (0)