Skip to content

Commit 9052d86

Browse files
author
MarcoFalke
committed
Merge bitcoin/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 #25179 ACKs for top commit: MarcoFalke: ACK 6fb102c Tree-SHA512: b2bca85fffa605aeb17574f050736d4556506d782dd7fd969e165e48e108fd95ef4c4e2abbae83cce05ca777a00f4459cabfa0932694fa8bb93ddfba09d84357
2 parents 7d51560 + 6fb102c commit 9052d86

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
@@ -62,7 +62,7 @@ def small_txpuzzle_randfee(
6262
unconflist.append({"txid": txid, "vout": 0, "value": total_in - amount - fee})
6363
unconflist.append({"txid": txid, "vout": 1, "value": amount})
6464

65-
return (tx.serialize().hex(), fee)
65+
return (tx.get_vsize(), fee)
6666

6767

6868
def check_raw_estimates(node, fees_seen):
@@ -158,7 +158,7 @@ def transact_and_mine(self, numblocks, mining_node):
158158
random.shuffle(self.confutxo)
159159
for _ in range(random.randrange(100 - 50, 100 + 50)):
160160
from_index = random.randint(1, 2)
161-
(txhex, fee) = small_txpuzzle_randfee(
161+
(tx_bytes, fee) = small_txpuzzle_randfee(
162162
self.wallet,
163163
self.nodes[from_index],
164164
self.confutxo,
@@ -167,7 +167,7 @@ def transact_and_mine(self, numblocks, mining_node):
167167
min_fee,
168168
min_fee,
169169
)
170-
tx_kbytes = (len(txhex) // 2) / 1000.0
170+
tx_kbytes = tx_bytes / 1000.0
171171
self.fees_per_kb.append(float(fee) / tx_kbytes)
172172
self.sync_mempools(wait=0.1)
173173
mined = mining_node.getblock(self.generate(mining_node, 1)[0], True)["tx"]

0 commit comments

Comments
 (0)