@@ -42,62 +42,15 @@ def setup_network(self):
4242 self .nodes .append (start_node (0 , self .options .tmpdir , ["-debug" , "-printpriority=1" ]))
4343 self .relayfee = self .nodes [0 ].getnetworkinfo ()['relayfee' ]
4444
45- def create_confirmed_utxos (self , count ):
46- self .nodes [0 ].generate (int (0.5 * count )+ 101 )
47- utxos = self .nodes [0 ].listunspent ()
48- iterations = count - len (utxos )
49- addr1 = self .nodes [0 ].getnewaddress ()
50- addr2 = self .nodes [0 ].getnewaddress ()
51- if iterations <= 0 :
52- return utxos
53- for i in xrange (iterations ):
54- t = utxos .pop ()
55- fee = self .relayfee
56- inputs = []
57- inputs .append ({ "txid" : t ["txid" ], "vout" : t ["vout" ]})
58- outputs = {}
59- send_value = t ['amount' ] - fee
60- outputs [addr1 ] = satoshi_round (send_value / 2 )
61- outputs [addr2 ] = satoshi_round (send_value / 2 )
62- raw_tx = self .nodes [0 ].createrawtransaction (inputs , outputs )
63- signed_tx = self .nodes [0 ].signrawtransaction (raw_tx )["hex" ]
64- txid = self .nodes [0 ].sendrawtransaction (signed_tx )
65-
66- while (self .nodes [0 ].getmempoolinfo ()['size' ] > 0 ):
67- self .nodes [0 ].generate (1 )
68-
69- utxos = self .nodes [0 ].listunspent ()
70- assert (len (utxos ) >= count )
71- return utxos
72-
73- def create_lots_of_big_transactions (self , utxos , fee ):
74- addr = self .nodes [0 ].getnewaddress ()
75- txids = []
76- for i in xrange (len (utxos )):
77- t = utxos .pop ()
78- inputs = []
79- inputs .append ({ "txid" : t ["txid" ], "vout" : t ["vout" ]})
80- outputs = {}
81- send_value = t ['amount' ] - fee
82- outputs [addr ] = satoshi_round (send_value )
83- rawtx = self .nodes [0 ].createrawtransaction (inputs , outputs )
84- newtx = rawtx [0 :92 ]
85- newtx = newtx + self .txouts
86- newtx = newtx + rawtx [94 :]
87- signresult = self .nodes [0 ].signrawtransaction (newtx , None , None , "NONE" )
88- txid = self .nodes [0 ].sendrawtransaction (signresult ["hex" ], True )
89- txids .append (txid )
90- return txids
91-
9245 def run_test (self ):
93- utxos = self . create_confirmed_utxos (90 )
46+ utxos = create_confirmed_utxos (self . relayfee , self . nodes [ 0 ], 90 )
9447 base_fee = self .relayfee * 100 # our transactions are smaller than 100kb
9548 txids = []
9649
9750 # Create 3 batches of transactions at 3 different fee rate levels
9851 for i in xrange (3 ):
9952 txids .append ([])
100- txids [i ] = self . create_lots_of_big_transactions (utxos [30 * i :30 * i + 30 ], (i + 1 )* base_fee )
53+ txids [i ] = create_lots_of_big_transactions (self . nodes [ 0 ], self . txouts , utxos [30 * i :30 * i + 30 ], (i + 1 )* base_fee )
10154
10255 # add a fee delta to something in the cheapest bucket and make sure it gets mined
10356 # also check that a different entry in the cheapest bucket is NOT mined (lower
0 commit comments