mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Have chainstate store CProof for each block header
This commit is contained in:
parent
60f70620c2
commit
6856bebb93
2 changed files with 13 additions and 2 deletions
14
src/chain.h
14
src/chain.h
|
|
@ -213,6 +213,7 @@ public:
|
|||
uint32_t block_height;
|
||||
uint32_t nBits;
|
||||
uint32_t nNonce;
|
||||
CProof proof;
|
||||
|
||||
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
|
||||
int32_t nSequenceId;
|
||||
|
|
@ -242,6 +243,7 @@ public:
|
|||
block_height = 0;
|
||||
nBits = 0;
|
||||
nNonce = 0;
|
||||
proof.SetNull();
|
||||
}
|
||||
|
||||
CBlockIndex()
|
||||
|
|
@ -259,6 +261,7 @@ public:
|
|||
block_height = block.block_height;
|
||||
nBits = block.nBits;
|
||||
nNonce = block.nNonce;
|
||||
proof = block.proof;
|
||||
}
|
||||
|
||||
CDiskBlockPos GetBlockPos() const {
|
||||
|
|
@ -290,6 +293,7 @@ public:
|
|||
block.block_height = block_height;
|
||||
block.nBits = nBits;
|
||||
block.nNonce = nNonce;
|
||||
block.proof = proof;
|
||||
return block;
|
||||
}
|
||||
|
||||
|
|
@ -408,8 +412,13 @@ public:
|
|||
READWRITE(hashMerkleRoot);
|
||||
READWRITE(nTime);
|
||||
READWRITE(block_height);
|
||||
READWRITE(nBits);
|
||||
READWRITE(nNonce);
|
||||
// For compatibility with elements 0.14 based chains
|
||||
if (g_signed_blocks) {
|
||||
READWRITE(proof);
|
||||
} else {
|
||||
READWRITE(nBits);
|
||||
READWRITE(nNonce);
|
||||
}
|
||||
}
|
||||
|
||||
uint256 GetBlockHash() const
|
||||
|
|
@ -422,6 +431,7 @@ public:
|
|||
block.block_height = block_height;
|
||||
block.nBits = nBits;
|
||||
block.nNonce = nNonce;
|
||||
block.proof = proof;
|
||||
return block.GetHash();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
|
|||
pindexNew->nTime = diskindex.nTime;
|
||||
pindexNew->nBits = diskindex.nBits;
|
||||
pindexNew->nNonce = diskindex.nNonce;
|
||||
pindexNew->proof = diskindex.proof;
|
||||
pindexNew->nStatus = diskindex.nStatus;
|
||||
pindexNew->nTx = diskindex.nTx;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue