1
1
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?
possible duplicate of https://bitcoin.stackexchange.com/questions/41196/how-is-the-size-of-a-block-calculated
– Nick ODell – 2017-06-09T23:18:53.0032I'm not treating it as a duplicate as a question about Bitcoin Core's serialization code is included. – Pieter Wuille – 2017-06-09T23:32:29.900