Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_preciousblock.py
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | class PreciousTest(BitcoinTestFramework): | ||||
def setup_network(self): | def setup_network(self): | ||||
self.setup_nodes() | self.setup_nodes() | ||||
def run_test(self): | def run_test(self): | ||||
self.log.info( | self.log.info( | ||||
"Ensure submitblock can in principle reorg to a competing chain") | "Ensure submitblock can in principle reorg to a competing chain") | ||||
# A non-wallet address to mine to | # A non-wallet address to mine to | ||||
def gen_address( | def gen_address( | ||||
i): return self.nodes[i].get_deterministic_priv_key().address | i): return self.nodes[i].get_deterministic_priv_key().address | ||||
self.nodes[0].generatetoaddress(1, gen_address(0)) | self.nodes[0].generatetoaddress(1, gen_address(0)) | ||||
assert_equal(self.nodes[0].getblockcount(), 1) | assert_equal(self.nodes[0].getblockcount(), 1) | ||||
hashZ = self.nodes[1].generatetoaddress(2, gen_address(1))[-1] | hashZ = self.nodes[1].generatetoaddress(2, gen_address(1))[-1] | ||||
assert_equal(self.nodes[1].getblockcount(), 2) | assert_equal(self.nodes[1].getblockcount(), 2) | ||||
node_sync_via_rpc(self.nodes[0:3]) | node_sync_via_rpc(self.nodes[0:3]) | ||||
assert_equal(self.nodes[0].getbestblockhash(), hashZ) | assert_equal(self.nodes[0].getbestblockhash(), hashZ) | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |