def test_create_submit_auxblock(self): """ Test the createauxblock / submitauxblock method pair. """ # Check for errors with wrong parameters. assert_raises_rpc_error(-1, None, self.nodes[0].createauxblock) assert_raises_rpc_error(-5, "Invalid coinbase payout address", self.nodes[0].createauxblock, "this_an_invalid_address") # Fix a coinbase address and construct methods for it. coinbaseAddr = self.nodes[0].getnewaddress() def create(): return self.nodes[0].createauxblock(coinbaseAddr) submit = self.nodes[0].submitauxblock # Run common tests. self.test_common(create, submit) # Ensure that the payout address is the one which we specify hash1 = mineAuxpowBlockWithMethods(create, submit) hash2 = mineAuxpowBlockWithMethods(create, submit) self.sync_all() addr1 = getCoinbaseAddr(self.nodes[1], hash1) addr2 = getCoinbaseAddr(self.nodes[1], hash2) assert_equal(addr1, coinbaseAddr) assert_equal(addr2, coinbaseAddr)
def test_create_submit_auxblock (self): """ Test the createauxblock / submitauxblock method pair. """ # Check for errors with wrong parameters. assert_raises_rpc_error (-1, None, self.nodes[0].createauxblock) assert_raises_rpc_error (-5, "Invalid coinbase payout address", self.nodes[0].createauxblock, "this_an_invalid_address") # Fix a coinbase address and construct methods for it. coinbaseAddr = self.nodes[0].getnewaddress () def create (): return self.nodes[0].createauxblock (coinbaseAddr) submit = self.nodes[0].submitauxblock # Run common tests. self.test_common (create, submit) # Ensure that the payout address is the one which we specify hash1 = mineAuxpowBlockWithMethods (create, submit) hash2 = mineAuxpowBlockWithMethods (create, submit) self.sync_all () addr1 = getCoinbaseAddr (self.nodes[1], hash1) addr2 = getCoinbaseAddr (self.nodes[1], hash2) assert_equal (addr1, coinbaseAddr) assert_equal (addr2, coinbaseAddr)
def test_getauxblock(self): """ Test the getauxblock method. """ create = self.nodes[0].getauxblock submit = self.nodes[0].getauxblock self.test_common(create, submit) # Ensure that the payout address is changed from one block to the next. hash1 = mineAuxpowBlockWithMethods(create, submit) hash2 = mineAuxpowBlockWithMethods(create, submit) self.sync_all() addr1 = getCoinbaseAddr(self.nodes[1], hash1) addr2 = getCoinbaseAddr(self.nodes[1], hash2) assert addr1 != addr2 info = self.nodes[0].getaddressinfo(addr1) assert info['ismine'] info = self.nodes[0].getaddressinfo(addr2) assert info['ismine']
def test_getauxblock (self): """ Test the getauxblock method. """ create = self.nodes[0].getauxblock submit = self.nodes[0].getauxblock self.test_common (create, submit) # Ensure that the payout address is changed from one block to the next. hash1 = mineAuxpowBlockWithMethods (create, submit) hash2 = mineAuxpowBlockWithMethods (create, submit) self.sync_all () addr1 = getCoinbaseAddr (self.nodes[1], hash1) addr2 = getCoinbaseAddr (self.nodes[1], hash2) assert addr1 != addr2 info = self.nodes[0].getaddressinfo (addr1) assert info['ismine'] info = self.nodes[0].getaddressinfo (addr2) assert info['ismine']
def test_create_submit_auxblock(self): """ Test the createauxblock / submitauxblock method pair. """ # Check for errors with wrong parameters. assert_raises_rpc_error(-1, None, self.nodes[0].createauxblock) assert_raises_rpc_error(-5, "Invalid coinbase payout address", self.nodes[0].createauxblock, "this_an_invalid_address") # Fix a coinbase address and construct methods for it. coinbaseAddr = "TDv1D3WV2gFK87ucb8bDG7KGjNh5HCPZPi" def create(): return self.nodes[0].createauxblock(coinbaseAddr) submit = self.nodes[0].submitauxblock # Run common tests. self.test_common(create, submit) # Ensure that the payout address is the one which we specify hash1 = mineAuxpowBlockWithMethods(create, submit) hash2 = mineAuxpowBlockWithMethods(create, submit) self.sync_all() addr1 = getCoinbaseAddr(self.nodes[1], hash1) addr2 = getCoinbaseAddr(self.nodes[1], hash2) assert_equal(addr1, coinbaseAddr) assert_equal(addr2, coinbaseAddr) # Ensure that different payout addresses will generate different auxblocks auxblock1 = self.nodes[0].createauxblock( "TMyMSQpgJR4QL6z6u5zz2dLWudi1x5Fobw") auxblock2 = self.nodes[0].createauxblock( "THG2uNG2VASsFWK4DmpZZpkwKtC5Qjkyoo") assert auxblock1['hash'] != auxblock2['hash']
def test_create_submit_auxblock(self): """ Test the createauxblock / submitauxblock method pair. """ # Check for errors with wrong parameters. assert_raises_rpc_error(-1, None, self.nodes[0].createauxblock) assert_raises_rpc_error(-5, "Invalid coinbase payout address", self.nodes[0].createauxblock, "this_an_invalid_address") # Fix a coinbase address and construct methods for it. addr1 = self.nodes[0].get_deterministic_priv_key().address def create(): return self.nodes[0].createauxblock(addr1) submit = self.nodes[0].submitauxblock # Run common tests. self.test_common(create, submit) # Ensure that the payout address is the one which we specify hash1 = mineAuxpowBlockWithMethods(create, submit) hash2 = mineAuxpowBlockWithMethods(create, submit) self.sync_all() actual1 = getCoinbaseAddr(self.nodes[1], hash1) actual2 = getCoinbaseAddr(self.nodes[1], hash2) assert_equal(actual1, addr1) assert_equal(actual2, addr1) # Ensure that different payout addresses will generate different auxblocks addr2 = self.nodes[1].get_deterministic_priv_key().address auxblock1 = self.nodes[0].createauxblock(addr1) auxblock2 = self.nodes[0].createauxblock(addr2) assert auxblock1['hash'] != auxblock2['hash']