Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251return block_3253def parallel_test(self, node, block_3):254# Ensure that getblocktemplate can be called concurrently by many threads.255self.log.info("Check blocks in parallel")256def check_50_blocks(n):257return [258assert_template(n, block_3, "bad-txns-inputs-missingorspent", submit=False)259for _ in range(50)260]261rpcs = [node.cli for _ in range(6)]262with ThreadPoolExecutor(max_workers=len(rpcs)) as threads:263list(threads.map(check_50_blocks, rpcs))265def run_test(self):266node = self.nodes[0]268block_0_height = node.getblockcount()269self.generate(node, sync_fun=self.no_op, nblocks=1)270block_1 = node.getblock(node.getbestblockhash())271block_2 = create_block(272int(block_1["hash"], 16),273height=block_0_height + 2,274ntime=block_1["mediantime"] + 1,275)277self.valid_block_test(node, block_2)278self.cb_missing_test(node, block_2)279self.block_without_transactions_test(node, block_2)280self.truncated_final_transaction_test(node, block_2)281self.duplicate_transaction_test(node, block_2)282self.thin_air_spending_test(node, block_2)283self.non_final_transaction_test(node, block_2)284self.bad_tx_count_test(node, block_2)285self.nbits_test(node, block_2)286self.merkle_root_test(node, block_2)287self.bad_timestamp_test(node, block_2)288self.current_tip_test(node, block_2)289# This sets the PoW for the next test290self.pow_test(node, block_2)291self.submit_test(node, block_0_height, block_2)293self.log.info("Generate a transaction")294tx = MiniWallet(node).create_self_transfer()296self.transaction_test(node, block_0_height, tx)297self.overspending_transaction_test(node, block_0_height, tx)298block_3 = self.spend_twice_test(node, block_0_height, tx)299self.parallel_test(node, block_3)301if __name__ == "__main__":302MiningTemplateVerificationTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.