Bitcoin Forum
September 08, 2026, 05:09:51 PM *
News: Latest Bitcoin Core release: 31.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why can't I sync blocks after forking Bitcoin v21.2?  (Read 104 times)
tedud (OP)
Newbie
*
Offline

Activity: 9
Merit: 7


View Profile
September 07, 2026, 02:30:39 AM
 #1

I deployed a fork of Bitcoin v21.2 on a server, but it fails to synchronize blocks; it just gets stuck displaying "Synchronizing block headers, height: 8 (~100.00%)." Why is this happening? Meanwhile, I can synchronize blocks using `addnode` with two Bitcoin-Qt nodes on a local virtual machine—why does it work there but not on the server?

2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/peers.dat
2026-09-07T02:15:49Z Invalid or missing peers.dat; recreating
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/anchors.dat
2026-09-07T02:15:49Z 0 block-relay-only anchors will be tried for connections.
2026-09-07T02:15:49Z init message: Starting network threads...
2026-09-07T02:15:49Z net thread start
2026-09-07T02:15:49Z init message: Done loading
2026-09-07T02:15:49Z dnsseed thread start
2026-09-07T02:15:49Z 0 addresses found from DNS seeds
2026-09-07T02:15:49Z dnsseed thread exit
2026-09-07T02:15:49Z opencon thread start
2026-09-07T02:15:49Z addcon thread start
2026-09-07T02:15:49Z msghand thread start
2026-09-07T02:15:51Z Synchronizing blockheaders, height: 7 (~100.00%)
2026-09-07T02:18:03Z Synchronizing blockheaders, height: 8 (~100.00%)
2026-09-07T02:20:32Z Synchronizing blockheaders, height: 9 (~100.00%)
2026-09-07T02:21:37Z Synchronizing blockheaders, height: 10 (~100.00%)
2026-09-07T02:24:28Z Synchronizing blockheaders, height: 11 (~100.00%)
2026-09-07T02:25:00Z Synchronizing blockheaders, height: 12 (~100.00%)
2026-09-07T02:27:58Z Synchronizing blockheaders, height: 13 (~100.00%)
2026-09-07T02:28:35Z Synchronizing blockheaders, height: 14 (~100.00%)
2026-09-07T02:29:48Z Synchronizing blockheaders, height: 15 (~100.00%)
nc50lc
Legendary
*
Offline

Activity: 3262
Merit: 9103


Self-proclaimed Genius


View Profile
September 07, 2026, 04:08:04 AM
Merited by ABCbits (1)
 #2

Start by describing what you've changed in your Bitcoin Core fork's code.
Without any information, I doubt anyone can accurately point the issue.

And does it has at least one peer?
Logs don't show any connected peer.

Quote from: tedud
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/peers.dat
2026-09-07T02:15:49Z Invalid or missing peers.dat; recreating
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/anchors.dat
These lines are normal if the node started from a fresh datadir without any of those files.

tedud (OP)
Newbie
*
Offline

Activity: 9
Merit: 7


View Profile
September 07, 2026, 06:11:12 AM
 #3

Start by describing what you've changed in your Bitcoin Core fork's code.
Without any information, I doubt anyone can accurately point the issue.

And does it has at least one peer?
Logs don't show any connected peer.

Quote from: tedud
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/peers.dat
2026-09-07T02:15:49Z Invalid or missing peers.dat; recreating
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/anchors.dat
These lines are normal if the node started from a fresh datadir without any of those files.



class CMainParams : public CChainParams {
public:
    CMainParams() {
        strNetworkID = CBaseChainParams::MAIN;
        consensus.signet_blocks = false;
        consensus.signet_challenge.clear();
        consensus.nSubsidyHalvingInterval = 210000;
        consensus.BIP16Exception = uint256();
        consensus.BIP34Height = 1000;
        consensus.BIP34Hash = uint256();
        consensus.BIP65Height = 1000;
        consensus.BIP66Height = 1000;
        consensus.CSVHeight = 1000;
        consensus.SegwitHeight = 1000;
        consensus.MinBIP9WarningHeight = 1000;
        consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 10 * 60;
        consensus.fPowAllowMinDifficultyBlocks = false;
        consensus.fPowNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 1815; // 90% of 2016
        consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

        // Deployment of Taproot (BIPs 340-342)
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1619222400; // April 24th, 2021
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0;

        consensus.nMinimumChainWork = uint256();
        consensus.defaultAssumeValid = uint256(); // 654683

        /**
         * The message start string is designed to be unlikely to occur in normal data.
         * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
         * a large 32-bit integer with any alignment.
         */
        pchMessageStart[0] = 0x42;
        pchMessageStart[1] = 0x49;
        pchMessageStart[2] = 0x54;
        pchMessageStart[3] = 0x4D;
        nDefaultPort = 6433;
        nPruneAfterHeight = 100000;
        m_assumed_blockchain_size = 350;
        m_assumed_chain_state_size = 6;

        genesis = CreateGenesisBlock(1787879432, 2318714909, 0x1d00ffff, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0x00000000b312706768c603a5e6cd6b7d1746476b4738b015318abb021ff0fbbd"));
        assert(genesis.hashMerkleRoot == uint256S("0xa4171db3d370aa7a4780c4b59530fe24ff1eb4ee41c22e651640a376897edd9e"));

        // Note that of those which support the service bits prefix, most only support a subset of
        // possible options.
        // This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the
        // service bits we want, but we should get them updated to support all service bits wanted by any
        // release ASAP to avoid it where possible.
        // vSeeds.emplace_back("seed.bitcoin.sipa.be"); // Pieter Wuille, only supports x1, x5, x9, and xd
        // vSeeds.emplace_back("dnsseed.bluematt.me"); // Matt Corallo, only supports x9
        // vSeeds.emplace_back("dnsseed.bitcoin.dashjr.org"); // Luke Dashjr
        // vSeeds.emplace_back("seed.bitcoinstats.com"); // Christian Decker, supports x1 - xf
        // vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch"); // Jonas Schnelli, only supports x1, x5, x9, and xd
        // vSeeds.emplace_back("seed.btc.petertodd.org"); // Peter Todd, only supports x1, x5, x9, and xd
        // vSeeds.emplace_back("seed.bitcoin.sprovoost.nl"); // Sjors Provoost
        // vSeeds.emplace_back("dnsseed.emzy.de"); // Stephan Oeste
        // vSeeds.emplace_back("seed.bitcoin.wiz.biz"); // Jason Maurice

        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,128);
        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};

        bech32_hrp = "bc";

        vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

        fDefaultConsistencyChecks = false;
        fRequireStandard = true;
        m_is_test_chain = false;
        m_is_mockable_chain = false;

        checkpointData = {
            {
                { 0, uint256S("0x00000000b312706768c603a5e6cd6b7d1746476b4738b015318abb021ff0fbbd")},
            }
        };

        chainTxData = ChainTxData{
            // Data from RPC: getchaintxstats 4096 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72
            /* nTime    */ 0,
            /* nTxCount */ 0,
            /* dTxRate  */ 0,
        };
    }
};
Start by describing what you've changed in your Bitcoin Core fork's code.
Without any information, I doubt anyone can accurately point the issue.

And does it has at least one peer?
Logs don't show any connected peer.

Quote from: tedud
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/peers.dat
2026-09-07T02:15:49Z Invalid or missing peers.dat; recreating
2026-09-07T02:15:49Z ERROR: DeserializeFileDB: Failed to open file /root/.bitcoin/anchors.dat
These lines are normal if the node started from a fresh datadir without any of those files.

I modified these contents, and also updated the ports in `chainparamsbase.cpp` and the IP addresses in `chainparamsseeds.h`.
ABCbits
Legendary
*
Offline

Activity: 3724
Merit: 10361



View Profile
September 07, 2026, 07:26:21 AM
 #4

I suspect possibility of XY problem, so i hope you don't mind asking this. What is your actual goal by modify source code from Bitcoin Core 0.21.2?

        assert(consensus.hashGenesisBlock == uint256S("0x00000000b312706768c603a5e6cd6b7d1746476b4738b015318abb021ff0fbbd"));

The hash doesn't even match with Bitcoin Core 0.21.2 source code.

assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));

tedud (OP)
Newbie
*
Offline

Activity: 9
Merit: 7


View Profile
September 07, 2026, 09:19:41 AM
 #5

I suspect possibility of XY problem, so i hope you don't mind asking this. What is your actual goal by modify source code from Bitcoin Core 0.21.2?

        assert(consensus.hashGenesisBlock == uint256S("0x00000000b312706768c603a5e6cd6b7d1746476b4738b015318abb021ff0fbbd"));

The hash doesn't even match with Bitcoin Core 0.21.2 source code.

assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
I was able to upgrade through several versions starting from Bitcoin v14 without issues, but it stopped working when I reached v21.2. Thinking it might be a version-specific problem, I upgraded to v24, yet it still fails to sync blocks—whereas the earlier versions had no trouble syncing. My ultimate goal is to interface it with an open-source mempool to generate images.

If my hash is incorrect, why is it still able to run and produce blocks?
nc50lc
Legendary
*
Offline

Activity: 3262
Merit: 9103


Self-proclaimed Genius


View Profile
September 07, 2026, 11:52:03 AM
Merited by ABCbits (3)
 #6

I was able to upgrade through several versions starting from Bitcoin v14 without issues, but it stopped working when I reached v21.2. Thinking it might be a version-specific problem, I upgraded to v24, yet it still fails to sync blocks—whereas the earlier versions had no trouble syncing.
AFAIK, v0.21.1 is the version where Taproot-related parameters are activated on mainnet but you've already addressed it by setting it to activate at 0 height.

But since you said it stopped at v0.21.2, have you tried v0.21.1 first? And it worked?
This is to narrow-down the versions that you need to look up, so that you can check the commits applied between those versions.
E.g.: These are the difference between v0.21.2 and v0.21.1: github.com/bitcoin/bitcoin/compare/v0.21.1...v0.21.2

tedud (OP)
Newbie
*
Offline

Activity: 9
Merit: 7


View Profile
Today at 03:56:45 AM
 #7

I was able to upgrade through several versions starting from Bitcoin v14 without issues, but it stopped working when I reached v21.2. Thinking it might be a version-specific problem, I upgraded to v24, yet it still fails to sync blocks—whereas the earlier versions had no trouble syncing.
AFAIK, v0.21.1 is the version where Taproot-related parameters are activated on mainnet but you've already addressed it by setting it to activate at 0 height.

But since you said it stopped at v0.21.2, have you tried v0.21.1 first? And it worked?
This is to narrow-down the versions that you need to look up, so that you can check the commits applied between those versions.
E.g.: These are the difference between v0.21.2 and v0.21.1: github.com/bitcoin/bitcoin/compare/v0.21.1...v0.21.2
Thanks, I'll go verify that right away.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!