From b4c5e5f56ef336ccc5438863fe2e7fdde30de660 Mon Sep 17 00:00:00 2001 From: Devan Kirkland Date: Sun, 10 May 2026 20:28:03 -0500 Subject: [PATCH] docs: add regtest generation troubleshooting --- examples/testing.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/testing.rst b/examples/testing.rst index a02076ca..d330844a 100644 --- a/examples/testing.rst +++ b/examples/testing.rst @@ -39,6 +39,12 @@ Start ``bitcoind`` in regtest mode to create a private block chain. Generate 101 blocks using a special `RPC <../reference/rpc/index.html>`__ which is only available in regtest mode. This takes less than a second on a generic PC. Because this is a new block chain using Bitcoin’s default rules, the first blocks pay a block reward of 50 bitcoins. Unlike mainnet, in regtest mode only the first 150 blocks pay a reward of 50 bitcoins. However, a block must have 100 confirmations before that reward can be spent, so we generate 101 blocks to get access to the coinbase transaction from block #1. +If block generation fails with an error such as ``CreateNewBlock: TestBlockValidity failed: bad-fork-prior-to-checkpoint (code 67)``, check the command and the regtest chain state: + +* Bitcoin Core 18.0 and later removed the old ``generate`` RPC. Use ``generatetoaddress`` with an address from the same regtest wallet, as shown above. +* If you are reusing an old or forked regtest directory, stop Bitcoin Core, remove only the ``regtest`` subdirectory from the Bitcoin Core configuration directory, restart with ``bitcoind -regtest -daemon``, and generate the initial 101 blocks again. +* Confirm every command is using ``-regtest``. Mixing mainnet, testnet, and regtest data directories can leave ``bitcoin-cli`` talking to the wrong node or wallet. + .. highlight:: bash ::