blockheaders include block height, nodes validate it

The block height validation is gated by the startup option
`con_blockheightinheader`, accesible in custom chains only
using option `chain=<name>`. Only if set to true will this
field be (de)serialized and evaluated in consensus logic.
Otherwise the field is simply ignored, other than being
stored in memory as the default value 0.
This commit is contained in:
Gregory Sanders 2018-10-12 14:47:35 -04:00
parent 8f6bedfd4b
commit 2bfabb3e4f
23 changed files with 180 additions and 129 deletions

View file

@ -263,6 +263,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
CBlockIndex* pindexNew = insertBlockIndex(diskindex.GetBlockHash());
pindexNew->pprev = insertBlockIndex(diskindex.hashPrev);
pindexNew->nHeight = diskindex.nHeight;
pindexNew->block_height = diskindex.block_height;
pindexNew->nFile = diskindex.nFile;
pindexNew->nDataPos = diskindex.nDataPos;
pindexNew->nUndoPos = diskindex.nUndoPos;