Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-minimaldata.py
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
class MinimaldataTest(BitcoinTestFramework): | class MinimaldataTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.block_heights = {} | self.block_heights = {} | ||||
def skip_test_if_missing_module(self): | |||||
self.skip_if_no_wallet() | |||||
def bootstrap_p2p(self, *, num_connections=1): | def bootstrap_p2p(self, *, num_connections=1): | ||||
"""Add a P2P connection to the node. | """Add a P2P connection to the node. | ||||
Helper to connect and wait for version handshake.""" | Helper to connect and wait for version handshake.""" | ||||
for _ in range(num_connections): | for _ in range(num_connections): | ||||
self.nodes[0].add_p2p_connection(P2PDataStore()) | self.nodes[0].add_p2p_connection(P2PDataStore()) | ||||
def reconnect_p2p(self, **kwargs): | def reconnect_p2p(self, **kwargs): | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
blocks = [] | blocks = [] | ||||
for _ in range(10): | for _ in range(10): | ||||
tip = self.build_block(tip) | tip = self.build_block(tip) | ||||
blocks.append(tip) | blocks.append(tip) | ||||
node.p2p.send_blocks_and_test(blocks, node, success=True) | node.p2p.send_blocks_and_test(blocks, node, success=True) | ||||
spendable_outputs = [block.vtx[0] for block in blocks] | spendable_outputs = [block.vtx[0] for block in blocks] | ||||
self.log.info("Mature the blocks and get out of IBD.") | self.log.info("Mature the blocks and get out of IBD.") | ||||
node.generate(100) | node.generatetoaddress(100, node.get_deterministic_priv_key().address) | ||||
tip = self.getbestblock(node) | tip = self.getbestblock(node) | ||||
self.log.info("Setting up spends to test and mining the fundings.") | self.log.info("Setting up spends to test and mining the fundings.") | ||||
fundings = [] | fundings = [] | ||||
def create_fund_and_spend_tx(): | def create_fund_and_spend_tx(): | ||||
spendfrom = spendable_outputs.pop() | spendfrom = spendable_outputs.pop() | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |