@@ -67,7 +67,6 @@ def setup_network(self, split=False):
6767
6868 connect_nodes_bi (self .nodes , 0 , 1 )
6969 self .parentgenesisblockhash = self .nodes [0 ].getblockhash (0 )
70- print ('parentgenesisblockhash' , self .parentgenesisblockhash )
7170 if not self .options .parent_bitcoin :
7271 parent_pegged_asset = self .nodes [0 ].getsidechaininfo ()['pegged_asset' ]
7372
@@ -150,24 +149,20 @@ def run_test(self):
150149
151150 addrs = sidechain .getpeginaddress ()
152151 addr = addrs ["mainchain_address" ]
153- print ('addrs' , addrs )
154- print (parent .getaddressinfo (addr ))
155152 txid1 = parent .sendtoaddress (addr , 24 )
156153 # 10+2 confirms required to get into mempool and confirm
157154 parent .generate (1 )
158155 time .sleep (2 )
159156 proof = parent .gettxoutproof ([txid1 ])
160157
161158 raw = parent .getrawtransaction (txid1 )
162- print ('raw' , parent .getrawtransaction (txid1 , True ))
163159
164- print ("Attempting peg-in " )
160+ print ("Attempting peg-ins " )
165161 # First attempt fails the consensus check but gives useful result
166162 try :
167163 pegtxid = sidechain .claimpegin (raw , proof )
168164 raise Exception ("Peg-in should not be mature enough yet, need another block." )
169165 except JSONRPCException as e :
170- print ('RPC ERROR:' , e .error ['message' ])
171166 assert ("Peg-in Bitcoin transaction needs more confirmations to be sent." in e .error ["message" ])
172167
173168 # Second attempt simply doesn't hit mempool bar
@@ -176,14 +171,12 @@ def run_test(self):
176171 pegtxid = sidechain .claimpegin (raw , proof )
177172 raise Exception ("Peg-in should not be mature enough yet, need another block." )
178173 except JSONRPCException as e :
179- print ('RPC ERROR:' , e .error ['message' ])
180174 assert ("Peg-in Bitcoin transaction needs more confirmations to be sent." in e .error ["message" ])
181175
182176 try :
183177 pegtxid = sidechain .createrawpegin (raw , proof , 'AEIOU' )
184178 raise Exception ("Peg-in with non-hex claim_script should fail." )
185179 except JSONRPCException as e :
186- print ('RPC ERROR:' , e .error ['message' ])
187180 assert ("Given claim_script is not hex." in e .error ["message" ])
188181
189182 # Should fail due to non-matching wallet address
@@ -192,7 +185,6 @@ def run_test(self):
192185 pegtxid = sidechain .claimpegin (raw , proof , scriptpubkey )
193186 raise Exception ("Peg-in with non-matching claim_script should fail." )
194187 except JSONRPCException as e :
195- print ('RPC ERROR:' , e .error ['message' ])
196188 assert ("Given claim_script does not match the given Bitcoin transaction." in e .error ["message" ])
197189
198190 # 12 confirms allows in mempool
@@ -211,7 +203,6 @@ def run_test(self):
211203
212204 tx1 = sidechain .gettransaction (pegtxid1 )
213205
214- print ('tx1' , tx1 )
215206 if "confirmations" in tx1 and tx1 ["confirmations" ] == 6 :
216207 print ("Peg-in is confirmed: Success!" )
217208 else :
@@ -225,7 +216,6 @@ def run_test(self):
225216 vsize = decoded ["vsize" ]
226217 fee_output = decoded ["vout" ][1 ]
227218 fallbackfee_pervbyte = Decimal ("0.00001" )/ Decimal ("1000" )
228- print ("fee_output" , fee_output )
229219 assert fee_output ["scriptPubKey" ]["type" ] == "fee"
230220 assert fee_output ["value" ] >= fallbackfee_pervbyte * vsize
231221
@@ -244,7 +234,7 @@ def run_test(self):
244234 # Do multiple claims in mempool
245235 n_claims = 6
246236
247- print ("Flooding mempool with many small claims" )
237+ print ("Flooding mempool with a few claims" )
248238 pegtxs = []
249239 sidechain .generate (101 )
250240
@@ -344,7 +334,6 @@ def run_test(self):
344334
345335 print ("Restarting parent2" )
346336 self .start_node (1 )
347- #parent2 = self.nodes[1]
348337 connect_nodes_bi (self .nodes , 0 , 1 )
349338
350339 # Don't make a block, race condition when pegin-invalid block
@@ -393,10 +382,16 @@ def run_test(self):
393382 # Make sure balance went down
394383 assert (bal_2 + 1 < bal_1 )
395384
385+ # Send rest of coins using subtractfee from output arg
386+ sidechain .sendtomainchain (some_btc_addr , bal_2 , True )
387+
388+ assert (sidechain .getwalletinfo ()["balance" ]['bitcoin' ] == 0 )
389+
390+ print ('Test coinbase peg-in maturity rules' )
391+
396392 # Have bitcoin output go directly into a claim output
397393 pegin_info = sidechain .getpeginaddress ()
398394 mainchain_addr = pegin_info ["mainchain_address" ]
399- claim_script = pegin_info ["claim_script" ]
400395 # Watch the address so we can get tx without txindex
401396 parent .importaddress (mainchain_addr )
402397 claim_block = parent .generatetoaddress (50 , mainchain_addr )[0 ]
@@ -422,12 +417,6 @@ def run_test(self):
422417 sidechain .generatetoaddress (1 , sidechain .getnewaddress ())
423418 assert_equal (sidechain .gettransaction (claim_txid )["confirmations" ], 1 )
424419
425-
426- # Send rest of coins using subtractfee from output arg
427- sidechain .sendtomainchain (some_btc_addr , sidechain .getwalletinfo ()["balance" ]['bitcoin' ], True )
428-
429- assert (sidechain .getwalletinfo ()["balance" ]['bitcoin' ] == 0 )
430-
431420 print ('Success!' )
432421
433422 # Manually stop sidechains first, then the parent chains.
0 commit comments