@@ -70,7 +70,6 @@ def on_pong(self, conn, message):
7070
7171 def on_reject (self , conn , message ):
7272 self .last_reject = message
73- #print (message)
7473
7574 # Syncing helpers
7675 def sync (self , test_function , timeout = 60 ):
@@ -224,7 +223,7 @@ def update_witness_block_with_transactions(self, block, tx_list, nonce=0):
224223
225224 ''' Individual tests '''
226225 def test_witness_services (self ):
227- print ( " \t Verifying NODE_WITNESS service bit" )
226+ self . log . info ( "Verifying NODE_WITNESS service bit" )
228227 assert ((self .test_node .connection .nServices & NODE_WITNESS ) != 0 )
229228
230229
@@ -233,7 +232,7 @@ def test_witness_services(self):
233232 def test_non_witness_transaction (self ):
234233 # Mine a block with an anyone-can-spend coinbase,
235234 # let it mature, then try to spend it.
236- print ( " \t Testing non-witness transaction" )
235+ self . log . info ( "Testing non-witness transaction" )
237236 block = self .build_next_block (nVersion = 1 )
238237 block .solve ()
239238 self .test_node .send_message (msg_block (block ))
@@ -262,7 +261,7 @@ def test_non_witness_transaction(self):
262261
263262 # Verify that blocks with witnesses are rejected before activation.
264263 def test_unnecessary_witness_before_segwit_activation (self ):
265- print ( " \t Testing behavior of unnecessary witnesses" )
264+ self . log . info ( "Testing behavior of unnecessary witnesses" )
266265 # For now, rely on earlier tests to have created at least one utxo for
267266 # us to use
268267 assert (len (self .utxo ) > 0 )
@@ -389,7 +388,7 @@ def advance_to_segwit_active(self):
389388
390389 # This test can only be run after segwit has activated
391390 def test_witness_commitments (self ):
392- print ( " \t Testing witness commitments" )
391+ self . log . info ( "Testing witness commitments" )
393392
394393 # First try a correct witness commitment.
395394 block = self .build_next_block ()
@@ -478,7 +477,7 @@ def test_witness_commitments(self):
478477
479478
480479 def test_block_malleability (self ):
481- print ( " \t Testing witness block malleability" )
480+ self . log . info ( "Testing witness block malleability" )
482481
483482 # Make sure that a block that has too big a virtual size
484483 # because of a too-large coinbase witness is not permanently
@@ -519,7 +518,7 @@ def test_block_malleability(self):
519518
520519
521520 def test_witness_block_size (self ):
522- print ( " \t Testing witness block size limit" )
521+ self . log . info ( "Testing witness block size limit" )
523522 # TODO: Test that non-witness carrying blocks can't exceed 1MB
524523 # Skipping this test for now; this is covered in p2p-fullblocktest.py
525524
@@ -636,7 +635,7 @@ def test_submit_block(self):
636635
637636 # Consensus tests of extra witness data in a transaction.
638637 def test_extra_witness_data (self ):
639- print ( " \t Testing extra witness data in tx" )
638+ self . log . info ( "Testing extra witness data in tx" )
640639
641640 assert (len (self .utxo ) > 0 )
642641
@@ -712,7 +711,7 @@ def test_extra_witness_data(self):
712711
713712 def test_max_witness_push_length (self ):
714713 ''' Should only allow up to 520 byte pushes in witness stack '''
715- print ( " \t Testing maximum witness push size" )
714+ self . log . info ( "Testing maximum witness push size" )
716715 MAX_SCRIPT_ELEMENT_SIZE = 520
717716 assert (len (self .utxo ))
718717
@@ -752,7 +751,7 @@ def test_max_witness_push_length(self):
752751 def test_max_witness_program_length (self ):
753752 # Can create witness outputs that are long, but can't be greater than
754753 # 10k bytes to successfully spend
755- print ( " \t Testing maximum witness program length" )
754+ self . log . info ( "Testing maximum witness program length" )
756755 assert (len (self .utxo ))
757756 MAX_PROGRAM_LENGTH = 10000
758757
@@ -801,7 +800,7 @@ def test_max_witness_program_length(self):
801800
802801 def test_witness_input_length (self ):
803802 ''' Ensure that vin length must match vtxinwit length '''
804- print ( " \t Testing witness input length" )
803+ self . log . info ( "Testing witness input length" )
805804 assert (len (self .utxo ))
806805
807806 witness_program = CScript ([OP_DROP , OP_TRUE ])
@@ -884,7 +883,7 @@ def serialize_with_witness(self):
884883
885884
886885 def test_witness_tx_relay_before_segwit_activation (self ):
887- print ( " \t Testing relay of witness transactions" )
886+ self . log . info ( "Testing relay of witness transactions" )
888887 # Generate a transaction that doesn't require a witness, but send it
889888 # with a witness. Should be rejected for premature-witness, but should
890889 # not be added to recently rejected list.
@@ -908,7 +907,7 @@ def test_witness_tx_relay_before_segwit_activation(self):
908907 # a witness transaction ought not result in a getdata.
909908 try :
910909 self .test_node .announce_tx_and_wait_for_getdata (tx , timeout = 2 )
911- print ("Error: duplicate tx getdata!" )
910+ self . log . error ("Error: duplicate tx getdata!" )
912911 assert (False )
913912 except AssertionError as e :
914913 pass
@@ -936,7 +935,7 @@ def test_witness_tx_relay_before_segwit_activation(self):
936935 # - accepts transactions with valid witnesses
937936 # and that witness transactions are relayed to non-upgraded peers.
938937 def test_tx_relay_after_segwit_activation (self ):
939- print ( " \t Testing relay of witness transactions" )
938+ self . log . info ( "Testing relay of witness transactions" )
940939 # Generate a transaction that doesn't require a witness, but send it
941940 # with a witness. Should be rejected because we can't use a witness
942941 # when spending a non-witness output.
@@ -1025,7 +1024,7 @@ def test_tx_relay_after_segwit_activation(self):
10251024 # This is true regardless of segwit activation.
10261025 # Also test that we don't ask for blocks from unupgraded peers
10271026 def test_block_relay (self , segwit_activated ):
1028- print ( " \t Testing block relay" )
1027+ self . log . info ( "Testing block relay" )
10291028
10301029 blocktype = 2 | MSG_WITNESS_FLAG
10311030
@@ -1113,7 +1112,7 @@ def test_block_relay(self, segwit_activated):
11131112
11141113 # V0 segwit outputs should be standard after activation, but not before.
11151114 def test_standardness_v0 (self , segwit_activated ):
1116- print ( " \t Testing standardness of v0 outputs (%s activation)" % ("after" if segwit_activated else "before" ))
1115+ self . log . info ( "Testing standardness of v0 outputs (%s activation)" % ("after" if segwit_activated else "before" ))
11171116 assert (len (self .utxo ))
11181117
11191118 witness_program = CScript ([OP_TRUE ])
@@ -1190,7 +1189,7 @@ def test_standardness_v0(self, segwit_activated):
11901189 # Verify that future segwit upgraded transactions are non-standard,
11911190 # but valid in blocks. Can run this before and after segwit activation.
11921191 def test_segwit_versions (self ):
1193- print ( " \t Testing standardness/consensus for segwit versions (0-16)" )
1192+ self . log . info ( "Testing standardness/consensus for segwit versions (0-16)" )
11941193 assert (len (self .utxo ))
11951194 NUM_TESTS = 17 # will test OP_0, OP1, ..., OP_16
11961195 if (len (self .utxo ) < NUM_TESTS ):
@@ -1274,7 +1273,7 @@ def test_segwit_versions(self):
12741273
12751274
12761275 def test_premature_coinbase_witness_spend (self ):
1277- print ( " \t Testing premature coinbase witness spend" )
1276+ self . log . info ( "Testing premature coinbase witness spend" )
12781277 block = self .build_next_block ()
12791278 # Change the output of the block to be a witness output.
12801279 witness_program = CScript ([OP_TRUE ])
@@ -1309,7 +1308,7 @@ def test_premature_coinbase_witness_spend(self):
13091308
13101309
13111310 def test_signature_version_1 (self ):
1312- print ( " \t Testing segwit signature hash version 1" )
1311+ self . log . info ( "Testing segwit signature hash version 1" )
13131312 key = CECKey ()
13141313 key .set_secretbytes (b"9" )
13151314 pubkey = CPubKey (key .get_pubkey ())
@@ -1491,7 +1490,7 @@ def test_signature_version_1(self):
14911490
14921491 # Test P2SH wrapped witness programs.
14931492 def test_p2sh_witness (self , segwit_activated ):
1494- print ( " \t Testing P2SH witness transactions" )
1493+ self . log . info ( "Testing P2SH witness transactions" )
14951494
14961495 assert (len (self .utxo ))
14971496
@@ -1564,7 +1563,7 @@ def test_p2sh_witness(self, segwit_activated):
15641563 # To enable this test, pass --oldbinary=<path-to-pre-segwit-bitcoind> to
15651564 # the test.
15661565 def test_upgrade_after_activation (self , node , node_id ):
1567- print ( " \t Testing software upgrade after softfork activation" )
1566+ self . log . info ( "Testing software upgrade after softfork activation" )
15681567
15691568 assert (node_id != 0 ) # node0 is assumed to be a segwit-active bitcoind
15701569
@@ -1592,7 +1591,7 @@ def test_upgrade_after_activation(self, node, node_id):
15921591
15931592 def test_witness_sigops (self ):
15941593 '''Ensure sigop counting is correct inside witnesses.'''
1595- print ( " \t Testing sigops limit" )
1594+ self . log . info ( "Testing sigops limit" )
15961595
15971596 assert (len (self .utxo ))
15981597
@@ -1694,7 +1693,7 @@ def test_witness_sigops(self):
16941693 # TODO: test p2sh sigop counting
16951694
16961695 def test_getblocktemplate_before_lockin (self ):
1697- print ( " \t Testing getblocktemplate setting of segwit versionbit (before lockin)" )
1696+ self . log . info ( "Testing getblocktemplate setting of segwit versionbit (before lockin)" )
16981697 # Node0 is segwit aware, node2 is not.
16991698 for node in [self .nodes [0 ], self .nodes [2 ]]:
17001699 gbt_results = node .getblocktemplate ()
@@ -1746,7 +1745,7 @@ def test_getblocktemplate_before_lockin(self):
17461745 # Uncompressed pubkeys are no longer supported in default relay policy,
17471746 # but (for now) are still valid in blocks.
17481747 def test_uncompressed_pubkey (self ):
1749- print ( " \t Testing uncompressed pubkeys" )
1748+ self . log . info ( "Testing uncompressed pubkeys" )
17501749 # Segwit transactions using uncompressed pubkeys are not accepted
17511750 # under default policy, but should still pass consensus.
17521751 key = CECKey ()
@@ -1848,7 +1847,7 @@ def test_uncompressed_pubkey(self):
18481847 self .utxo .append (UTXO (tx5 .sha256 , 0 , tx5 .vout [0 ].nValue ))
18491848
18501849 def test_non_standard_witness (self ):
1851- print ( " \t Testing detection of non-standard P2WSH witness" )
1850+ self . log . info ( "Testing detection of non-standard P2WSH witness" )
18521851 pad = chr (1 ).encode ('latin-1' )
18531852
18541853 # Create scripts for tests
@@ -1972,7 +1971,7 @@ def run_test(self):
19721971 # Test logic begins here
19731972 self .test_node .wait_for_verack ()
19741973
1975- print ( " \n Starting tests before segwit lock in:" )
1974+ self . log . info ( "Starting tests before segwit lock in:" )
19761975
19771976 self .test_witness_services () # Verifies NODE_WITNESS
19781977 self .test_non_witness_transaction () # non-witness tx's are accepted
@@ -1987,7 +1986,7 @@ def run_test(self):
19871986 sync_blocks (self .nodes )
19881987
19891988 # At lockin, nothing should change.
1990- print ( " \n Testing behavior post lockin, pre-activation" )
1989+ self . log . info ( "Testing behavior post lockin, pre-activation" )
19911990 self .advance_to_segwit_lockin ()
19921991
19931992 # Retest unnecessary witnesses
@@ -2000,7 +1999,7 @@ def run_test(self):
20001999 sync_blocks (self .nodes )
20012000
20022001 # Now activate segwit
2003- print ( " \n Testing behavior after segwit activation" )
2002+ self . log . info ( "Testing behavior after segwit activation" )
20042003 self .advance_to_segwit_active ()
20052004
20062005 sync_blocks (self .nodes )
0 commit comments