28
28
# Associated ScriptSig's to spend satisfy P2SH_1 and P2SH_2
29
29
SCRIPT_SIG = [CScript ([OP_TRUE , REDEEM_SCRIPT_1 ]), CScript ([OP_TRUE , REDEEM_SCRIPT_2 ])]
30
30
31
+
31
32
def small_txpuzzle_randfee (from_node , conflist , unconflist , amount , min_fee , fee_increment ):
32
33
"""Create and send a transaction with a random fee.
33
34
@@ -69,6 +70,7 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
69
70
70
71
return (ToHex (tx ), fee )
71
72
73
+
72
74
def split_inputs (from_node , txins , txouts , initial_split = False ):
73
75
"""Generate a lot of inputs so we can generate a ton of transactions.
74
76
@@ -97,6 +99,7 @@ def split_inputs(from_node, txins, txouts, initial_split=False):
97
99
txouts .append ({"txid" : txid , "vout" : 0 , "amount" : half_change })
98
100
txouts .append ({"txid" : txid , "vout" : 1 , "amount" : rem_change })
99
101
102
+
100
103
def check_estimates (node , fees_seen ):
101
104
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
102
105
@@ -125,10 +128,11 @@ class EstimateFeeTest(BitcoinTestFramework):
125
128
def set_test_params (self ):
126
129
self .num_nodes = 3
127
130
# mine non-standard txs (e.g. txs with "dust" outputs)
131
+ # Force fSendTrickle to true (via whitelist)
128
132
self .extra_args = [
129
- ["-acceptnonstdtxn" , "-maxorphantx=1000" , "- whitelist=127.0.0.1" ],
130
- ["-acceptnonstdtxn" , "-blockmaxweight=68000 " , "-maxorphantx=1000 " ],
131
- ["-acceptnonstdtxn" , "-blockmaxweight=32000 " , "-maxorphantx=1000 " ],
133
+ ["-acceptnonstdtxn" , "-whitelist=127.0.0.1" ],
134
+ ["-acceptnonstdtxn" , "-whitelist=127.0.0.1 " , "-blockmaxweight=68000 " ],
135
+ ["-acceptnonstdtxn" , "-whitelist=127.0.0.1 " , "-blockmaxweight=32000 " ],
132
136
]
133
137
134
138
def skip_test_if_missing_module (self ):
@@ -165,9 +169,9 @@ def transact_and_mine(self, numblocks, mining_node):
165
169
self .memutxo , Decimal ("0.005" ), min_fee , min_fee )
166
170
tx_kbytes = (len (txhex ) // 2 ) / 1000.0
167
171
self .fees_per_kb .append (float (fee ) / tx_kbytes )
168
- self .sync_mempools (self . nodes [ 0 : 3 ], wait = .1 )
172
+ self .sync_mempools (wait = .1 )
169
173
mined = mining_node .getblock (mining_node .generate (1 )[0 ], True )["tx" ]
170
- self .sync_blocks (self . nodes [ 0 : 3 ], wait = .1 )
174
+ self .sync_blocks (wait = .1 )
171
175
# update which txouts are confirmed
172
176
newmem = []
173
177
for utx in self .memutxo :
@@ -189,22 +193,22 @@ def run_test(self):
189
193
split_inputs (self .nodes [0 ], self .nodes [0 ].listunspent (0 ), self .txouts , True )
190
194
191
195
# Mine
192
- while ( len (self .nodes [0 ].getrawmempool ()) > 0 ) :
196
+ while len (self .nodes [0 ].getrawmempool ()) > 0 :
193
197
self .nodes [0 ].generate (1 )
194
198
195
199
# Repeatedly split those 2 outputs, doubling twice for each rep
196
200
# Use txouts to monitor the available utxo, since these won't be tracked in wallet
197
201
reps = 0
198
- while ( reps < 5 ) :
202
+ while reps < 5 :
199
203
# Double txouts to txouts2
200
- while ( len (self .txouts ) > 0 ) :
204
+ while len (self .txouts ) > 0 :
201
205
split_inputs (self .nodes [0 ], self .txouts , self .txouts2 )
202
- while ( len (self .nodes [0 ].getrawmempool ()) > 0 ) :
206
+ while len (self .nodes [0 ].getrawmempool ()) > 0 :
203
207
self .nodes [0 ].generate (1 )
204
208
# Double txouts2 to txouts
205
- while ( len (self .txouts2 ) > 0 ) :
209
+ while len (self .txouts2 ) > 0 :
206
210
split_inputs (self .nodes [0 ], self .txouts2 , self .txouts )
207
- while ( len (self .nodes [0 ].getrawmempool ()) > 0 ) :
211
+ while len (self .nodes [0 ].getrawmempool ()) > 0 :
208
212
self .nodes [0 ].generate (1 )
209
213
reps += 1
210
214
self .log .info ("Finished splitting" )
@@ -244,5 +248,6 @@ def run_test(self):
244
248
self .log .info ("Final estimates after emptying mempools" )
245
249
check_estimates (self .nodes [1 ], self .fees_per_kb )
246
250
251
+
247
252
if __name__ == '__main__' :
248
253
EstimateFeeTest ().main ()
0 commit comments