In main.h (line 17) we have a constant MAX_SIZE

static const unsigned int MAX_SIZE = 0x02000000;

which in decimal format equals to 33554432 (32MB)

This constant is used to verify if the block passes the size limit in main.cpp (line 1154)

    bool CBlock::CheckBlock() const
        // These are checks that are independent of context
        // that can be verified before saving an orphan block.

        // Size limits
        if (vtx.empty() || vtx.size() > MAX_SIZE || ::GetSerializeSize(*this, SER_DISK) > MAX_SIZE)
            return error("CheckBlock() : size limits failed");

According to the git pull request history line 18 was added to main.h by Gavin Andresen:

static const unsigned int MAX_BLOCK_SIZE = 1000000;


this new constant appears to only be used on the BitcoinMiner() function on main.cpp


 if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE - 10000)

Apparently Satoshi believed that this would split the chain but this is only established on the mining node, not on a node that is just collecting new block and adding them to their chain.

What is the significance of this last line? How does this impact consensus? Where is the code limiting block size in the most current version of Bitcoin Core?


1 Answer 1


What is the significance of this last line?

It ensures that the built-in miner does not create blocks that are larger than MAX_BLOCK_SIZE. It checks whether the transaction selected be larger than the limit. The reason there is a - 10000 is to ensure that there is enough space for the coinbase transaction and the block header.

How does this impact consensus?

It's effectively a soft fork. Miners won't make blocks larger than MAX_BLOCK_SIZE. Otherwise there is no effect on consensus.

Where is the code limiting block size in the most current version of Bitcoin Core?

It's in CheckBlock(), the same function the size check was since a size check has existed. Of course the location of this function has moved. Currently it is here: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L3093

  • also, the variable is defined on src/consensus/consensus.h . /** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */ static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
    – Pedro
    Commented Apr 21, 2019 at 23:09
  • added here github.com/bitcoin/bitcoin/blame/0.14/src/consensus/consensus.h
    – Pedro
    Commented Apr 21, 2019 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.