diff options
| author | Max K <[email protected]> | 2019-07-14 19:35:30 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-07-14 19:35:30 +0200 |
| commit | cee13699a5676355487f8eb2d91985f63438eae4 (patch) | |
| tree | cf12be6180f950a25ee2ee7f3f2126542835d6e3 /src/chain.cpp | |
| parent | Correct build and test net seed (diff) | |
| parent | Handle legacy v2 block at #66064 (diff) | |
| download | discoin-cee13699a5676355487f8eb2d91985f63438eae4.tar.xz discoin-cee13699a5676355487f8eb2d91985f63438eae4.zip | |
Merge pull request #1546 from rnicoll/1.17-auxpow1.17-dev
1.17 AuxPoW support
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 |