Published on: 2014-07-22T11:13:50+00:00
The author is currently working on a BIP that requires modifications to the block acceptance rules. They have two options for testing this BIP: mining blocks on the testnet or creating test cases for Bitcoin Core. The author specifically wants to create test cases for the block.CheckBlock() function by verifying 100 dynamically generated blocks.However, there are some uncertainties regarding the state of the blockchain when executing a test case. It is unclear which network (regtest, testnet3, or mainnet) the test case is configured for and what blocks are present in the blockchain. Upon investigation, the author discovered that the checkblock_tests.cpp file is the only test case available for CheckBlock(). However, this test case assumes that the mainnet is configured. To overcome this limitation, the author needs to utilize regtest, which will allow them to create blocks with a difficulty of 1.Currently, there is no infrastructure for writing blockchain unit tests. To address this issue, the pull tester has been extended as a solution. The pull tester is an app called BitcoindComparisonTool, based on bitcoinj, that builds a regtest chain and submits it to a local regtest node. This tool enables testing of reorgs and various rules by communicating with the node solely via P2P.While the pull tester provides a potential solution, there is still room for improvement. The code requires cleaning up, as copy/paste coding is prevalent. Additionally, the ease of verifying a BIP via P2P plays a crucial role in determining its feasibility.
Updated on: 2023-08-01T09:55:56.466003+00:00