I was able to follow the code to validation.cpp:
// Size limits
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_BASE_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) > MAX_BLOCK_BASE_SIZE)
return state.DoS(100, false, REJECT_INVALID, "bad-blk-length", false, "size limits failed");
and serialize.h:
template <typename T>
size_t GetSerializeSize(const T& t, int nType, int nVersion = 0)
{
return (CSizeComputer(nType, nVersion) << t).size();
}
But for the life of me I can't figure out what CSizeComputer
is doing. Does GetSerializeSize
include the block header in the value it returns?