test: Changed small_txpuzzle_randfee to return the virtual size instead of the transaction hex for feerate calculation.

This commit is contained in:
Randall Naar 2022-11-17 00:07:25 -05:00
parent 6863ad79a6
commit 6fb102c9f3

View file

@ -62,7 +62,7 @@ def small_txpuzzle_randfee(
unconflist.append({"txid": txid, "vout": 0, "value": total_in - amount - fee}) unconflist.append({"txid": txid, "vout": 0, "value": total_in - amount - fee})
unconflist.append({"txid": txid, "vout": 1, "value": amount}) unconflist.append({"txid": txid, "vout": 1, "value": amount})
return (tx.serialize().hex(), fee) return (tx.get_vsize(), fee)
def check_raw_estimates(node, fees_seen): def check_raw_estimates(node, fees_seen):
@ -158,7 +158,7 @@ class EstimateFeeTest(BitcoinTestFramework):
random.shuffle(self.confutxo) random.shuffle(self.confutxo)
for _ in range(random.randrange(100 - 50, 100 + 50)): for _ in range(random.randrange(100 - 50, 100 + 50)):
from_index = random.randint(1, 2) from_index = random.randint(1, 2)
(txhex, fee) = small_txpuzzle_randfee( (tx_bytes, fee) = small_txpuzzle_randfee(
self.wallet, self.wallet,
self.nodes[from_index], self.nodes[from_index],
self.confutxo, self.confutxo,
@ -167,7 +167,7 @@ class EstimateFeeTest(BitcoinTestFramework):
min_fee, min_fee,
min_fee, min_fee,
) )
tx_kbytes = (len(txhex) // 2) / 1000.0 tx_kbytes = tx_bytes / 1000.0
self.fees_per_kb.append(float(fee) / tx_kbytes) self.fees_per_kb.append(float(fee) / tx_kbytes)
self.sync_mempools(wait=0.1) self.sync_mempools(wait=0.1)
mined = mining_node.getblock(self.generate(mining_node, 1)[0], True)["tx"] mined = mining_node.getblock(self.generate(mining_node, 1)[0], True)["tx"]