Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mining.py
Show All 23 Lines | def assert_template(node, block, expect, rehash=True): | ||||
if rehash: | if rehash: | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
rsp = node.getblocktemplate( | rsp = node.getblocktemplate( | ||||
{'data': b2x(block.serialize()), 'mode': 'proposal'}) | {'data': b2x(block.serialize()), 'mode': 'proposal'}) | ||||
assert_equal(rsp, expect) | assert_equal(rsp, expect) | ||||
class MiningTest(BitcoinTestFramework): | class MiningTest(BitcoinTestFramework): | ||||
''' | def set_test_params(self): | ||||
Test block proposals with getblocktemplate. | |||||
''' | |||||
def __init__(self): | |||||
super().__init__() | |||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
def run_test(self): | def run_test(self): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
# Mine a block to leave initial block download | # Mine a block to leave initial block download | ||||
node.generate(1) | node.generate(1) | ||||
tmpl = node.getblocktemplate() | tmpl = node.getblocktemplate() | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |