aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/preciousblock.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-07 18:46:17 -0500
committerJohn Newbery <john@johnnewbery.com>2017-03-09 09:26:48 -0500
commit64c080051b932b3e53ece7638f199e48d0ad16c8 (patch)
tree87dbf2ccfa73d4650556919e92108033b54fc9a7 /qa/rpc-tests/preciousblock.py
parent38ad281b2ad526f4aeef9445c1aa3715d692d861 (diff)
downloadbitcoin-64c080051b932b3e53ece7638f199e48d0ad16c8.tar.xz
Use logging in individual tests
Diffstat (limited to 'qa/rpc-tests/preciousblock.py')
-rwxr-xr-xqa/rpc-tests/preciousblock.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/qa/rpc-tests/preciousblock.py b/qa/rpc-tests/preciousblock.py
index 01e5d94c96..30b0b5a301 100755
--- a/qa/rpc-tests/preciousblock.py
+++ b/qa/rpc-tests/preciousblock.py
@@ -44,7 +44,7 @@ class PreciousTest(BitcoinTestFramework):
self.nodes = self.setup_nodes()
def run_test(self):
- print("Ensure submitblock can in principle reorg to a competing chain")
+ self.log.info("Ensure submitblock can in principle reorg to a competing chain")
self.nodes[0].generate(1)
assert_equal(self.nodes[0].getblockcount(), 1)
(hashY, hashZ) = self.nodes[1].generate(2)
@@ -52,62 +52,62 @@ class PreciousTest(BitcoinTestFramework):
node_sync_via_rpc(self.nodes[0:3])
assert_equal(self.nodes[0].getbestblockhash(), hashZ)
- print("Mine blocks A-B-C on Node 0")
+ self.log.info("Mine blocks A-B-C on Node 0")
(hashA, hashB, hashC) = self.nodes[0].generate(3)
assert_equal(self.nodes[0].getblockcount(), 5)
- print("Mine competing blocks E-F-G on Node 1")
+ self.log.info("Mine competing blocks E-F-G on Node 1")
(hashE, hashF, hashG) = self.nodes[1].generate(3)
assert_equal(self.nodes[1].getblockcount(), 5)
assert(hashC != hashG)
- print("Connect nodes and check no reorg occurs")
+ self.log.info("Connect nodes and check no reorg occurs")
# Submit competing blocks via RPC so any reorg should occur before we proceed (no way to wait on inaction for p2p sync)
node_sync_via_rpc(self.nodes[0:2])
connect_nodes_bi(self.nodes,0,1)
assert_equal(self.nodes[0].getbestblockhash(), hashC)
assert_equal(self.nodes[1].getbestblockhash(), hashG)
- print("Make Node0 prefer block G")
+ self.log.info("Make Node0 prefer block G")
self.nodes[0].preciousblock(hashG)
assert_equal(self.nodes[0].getbestblockhash(), hashG)
- print("Make Node0 prefer block C again")
+ self.log.info("Make Node0 prefer block C again")
self.nodes[0].preciousblock(hashC)
assert_equal(self.nodes[0].getbestblockhash(), hashC)
- print("Make Node1 prefer block C")
+ self.log.info("Make Node1 prefer block C")
self.nodes[1].preciousblock(hashC)
sync_chain(self.nodes[0:2]) # wait because node 1 may not have downloaded hashC
assert_equal(self.nodes[1].getbestblockhash(), hashC)
- print("Make Node1 prefer block G again")
+ self.log.info("Make Node1 prefer block G again")
self.nodes[1].preciousblock(hashG)
assert_equal(self.nodes[1].getbestblockhash(), hashG)
- print("Make Node0 prefer block G again")
+ self.log.info("Make Node0 prefer block G again")
self.nodes[0].preciousblock(hashG)
assert_equal(self.nodes[0].getbestblockhash(), hashG)
- print("Make Node1 prefer block C again")
+ self.log.info("Make Node1 prefer block C again")
self.nodes[1].preciousblock(hashC)
assert_equal(self.nodes[1].getbestblockhash(), hashC)
- print("Mine another block (E-F-G-)H on Node 0 and reorg Node 1")
+ self.log.info("Mine another block (E-F-G-)H on Node 0 and reorg Node 1")
self.nodes[0].generate(1)
assert_equal(self.nodes[0].getblockcount(), 6)
sync_blocks(self.nodes[0:2])
hashH = self.nodes[0].getbestblockhash()
assert_equal(self.nodes[1].getbestblockhash(), hashH)
- print("Node1 should not be able to prefer block C anymore")
+ self.log.info("Node1 should not be able to prefer block C anymore")
self.nodes[1].preciousblock(hashC)
assert_equal(self.nodes[1].getbestblockhash(), hashH)
- print("Mine competing blocks I-J-K-L on Node 2")
+ self.log.info("Mine competing blocks I-J-K-L on Node 2")
self.nodes[2].generate(4)
assert_equal(self.nodes[2].getblockcount(), 6)
hashL = self.nodes[2].getbestblockhash()
- print("Connect nodes and check no reorg occurs")
+ self.log.info("Connect nodes and check no reorg occurs")
node_sync_via_rpc(self.nodes[1:3])
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
assert_equal(self.nodes[0].getbestblockhash(), hashH)
assert_equal(self.nodes[1].getbestblockhash(), hashH)
assert_equal(self.nodes[2].getbestblockhash(), hashL)
- print("Make Node1 prefer block L")
+ self.log.info("Make Node1 prefer block L")
self.nodes[1].preciousblock(hashL)
assert_equal(self.nodes[1].getbestblockhash(), hashL)
- print("Make Node2 prefer block H")
+ self.log.info("Make Node2 prefer block H")
self.nodes[2].preciousblock(hashH)
assert_equal(self.nodes[2].getbestblockhash(), hashH)