Bitcoin-abc节点与BCH测试网区块数据不一致的技术问询
I’ve looked over your issue—you’re running Bitcoin ABC v0.19.6 and v0.18.5 on testnet, but your node’s chain is ~100 blocks ahead of the Bitcoin.com explorer, and the block hash for height 1306255 doesn’t match. Plus, your debug.log shows an invalid block header error. Let’s break this down and fix it:
What’s Going On?
The core problem is a chain divergence: your node is rejecting a block that the Bitcoin.com explorer accepts, so it’s following a different fork of the testnet chain. The error in your debug log is critical here:
2019-05-30T11:33:56Z ERROR: AcceptBlockHeader: block 000000000000003a3fb0ca1611035346a803e0344d6bb2eb4f5ea75f4dc2291c is marked invalid
2019-05-30T11:33:56Z ERROR: invalid header received
Your node doesn’t recognize this block as valid under Bitcoin ABC’s consensus rules, so it skips it and follows the longest valid chain available—hence the height mismatch and differing hash for block 1306255.
Common Causes
- Temporary testnet chain split: Testnets are often used to experiment with consensus changes, so forks happen more frequently than on mainnet.
- Corrupted chain data: If your datadir has damaged block data, your node might reject valid blocks or follow an invalid fork.
- Peer issues: Your node might be connected to untrusted peers serving an invalid chain.
Step-by-Step Solutions
1. Verify You’re on the Correct Testnet
Double-check that the explorer is showing BCH testnet (tbch) (not BTC testnet) and that your node is configured for BCH testnet. Your config already has testnet=1, which is correct for Bitcoin ABC’s testnet, but it’s worth confirming.
2. Rebuild the Chain from Scratch
Corrupted data is the most likely fix here. Here’s how to do it safely:
- Stop your node:
bitcoin-cli -conf=/data/xxx-bch-test/bitcoin.conf stop - Back up your existing testnet data (in case you need it later):
mv /data/xxx-bch-test/testnet /data/xxx-bch-test/testnet_backup - Create a fresh datadir:
mkdir /data/xxx-bch-test/testnet - Restart your node with your original command:
bin/bitcoind -conf=/data/xxx-bch-test/bitcoin.conf -datadir=/data/xxx-bch-test/testnet -testnet & - Let the node fully sync (this can take a few hours). Once done, check block 1306255 again—its hash should match the explorer’s.
3. Add Trusted Peers
To avoid connecting to bad peers, add these trusted BCH testnet nodes to your bitcoin.conf:
addnode=testnet-seed.bitcoinabc.org addnode=testnet-seed-abc.bitcoinforks.org
Restart your node to apply the changes. This ensures you’re syncing from valid, trusted sources.
4. Validate the Fix
After syncing, run this RPC call to check block 1306255:
bitcoin-cli -conf=/data/xxx-bch-test/bitcoin.conf getblock 1306255
The hash field should now match the one from the explorer: 0000000000000340762ba9648a982a18442ff7423e787d4115da323a399dc57b.
Extra Tips
- If you don’t need transaction indexing, disable
txindex=1in your config to speed up sync time. - Ensure your node has enough disk space (BCH testnet is ~5-10GB as of 2024) and stable bandwidth for syncing.
内容的提问来源于stack exchange,提问作者rayeaster

