diff options
Diffstat (limited to 'src/chain.cpp')
| -rw-r--r-- | src/chain.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/chain.cpp b/src/chain.cpp index d462f94ab..5cb09f6fc 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -4,6 +4,34 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <chain.h> +#include <validation.h> + +using namespace std; + +/* Moved here from the header, because we need auxpow and the logic + becomes more involved. */ +CBlockHeader CBlockIndex::GetBlockHeader(const Consensus::Params& consensusParams) const +{ + CBlockHeader block; + + /* The CBlockIndex object's block header is missing the auxpow. + So if this is an auxpow block, read it from disk instead. We only + have to read the actual *header*, not the full block. */ + if (block.IsAuxpow()) + { + ReadBlockHeaderFromDisk(block, this, consensusParams); + return block; + } + + block.nVersion = nVersion; + if (pprev) + block.hashPrevBlock = pprev->GetBlockHash(); + block.hashMerkleRoot = hashMerkleRoot; + block.nTime = nTime; + block.nBits = nBits; + block.nNonce = nNonce; + return block; +} /** * CChain implementation |