diff options
Diffstat (limited to 'src/chain.cpp')
| -rw-r--r-- | src/chain.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/chain.cpp b/src/chain.cpp index 719256106..e76073674 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -5,8 +5,35 @@ #include "chain.h" +#include "main.h" + using namespace std; +/* Moved here from the header, because we need auxpow and the logic + becomes more involved. */ +CBlockHeader CBlockIndex::GetBlockHeader() 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 (nVersion.IsAuxpow()) + { + ReadBlockHeaderFromDisk(block, this); + 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 */ |