aboutsummaryrefslogtreecommitdiff
path: root/src/chain.cpp
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2015-07-11 14:41:33 +0200
committerPatrick Lodder <[email protected]>2015-07-11 14:41:33 +0200
commitb66e509800025bbcd90f518b90f3b7cb582b99db (patch)
tree0422e17d73ffc244e48ba41c4ea63cd39c8b09dd /src/chain.cpp
parentMerge pull request #1199 from patricklodder/1.10-partition-alert (diff)
parentAdapt AuxPoW to Dogecoin (diff)
downloaddiscoin-b66e509800025bbcd90f518b90f3b7cb582b99db.tar.xz
discoin-b66e509800025bbcd90f518b90f3b7cb582b99db.zip
Merge pull request #1200 from rnicoll/1.10-auxpow-clean
Add AuxPoW support
Diffstat (limited to 'src/chain.cpp')
-rw-r--r--src/chain.cpp27
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
*/