@@ -131,16 +131,15 @@ def check_estimates(node, fees_seen):
131
131
132
132
def send_tx (node , utxo , feerate ):
133
133
"""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
-
138
134
tx = CTransaction ()
139
135
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
142
141
143
- return txid
142
+ return node . sendrawtransaction ( tx . serialize (). hex ())
144
143
145
144
146
145
class EstimateFeeTest (BitcoinTestFramework ):
@@ -297,12 +296,9 @@ def sanity_check_rbf_estimates(self, utxos):
297
296
miner .prioritisetransaction (txid = txid , fee_delta = - COIN )
298
297
self .generate (miner , 1 )
299
298
# 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 )
306
302
307
303
# Mine the last replacement txs
308
304
self .sync_mempools (wait = 0.1 , nodes = [node , miner ])
0 commit comments