mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +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 block_height;
|
||||||
uint32_t nBits;
|
uint32_t nBits;
|
||||||
uint32_t nNonce;
|
uint32_t nNonce;
|
||||||
|
CProof proof;
|
||||||
|
|
||||||
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
|
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
|
||||||
int32_t nSequenceId;
|
int32_t nSequenceId;
|
||||||
|
|
@ -242,6 +243,7 @@ public:
|
||||||
block_height = 0;
|
block_height = 0;
|
||||||
nBits = 0;
|
nBits = 0;
|
||||||
nNonce = 0;
|
nNonce = 0;
|
||||||
|
proof.SetNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
CBlockIndex()
|
CBlockIndex()
|
||||||
|
|
@ -259,6 +261,7 @@ public:
|
||||||
block_height = block.block_height;
|
block_height = block.block_height;
|
||||||
nBits = block.nBits;
|
nBits = block.nBits;
|
||||||
nNonce = block.nNonce;
|
nNonce = block.nNonce;
|
||||||
|
proof = block.proof;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDiskBlockPos GetBlockPos() const {
|
CDiskBlockPos GetBlockPos() const {
|
||||||
|
|
@ -290,6 +293,7 @@ public:
|
||||||
block.block_height = block_height;
|
block.block_height = block_height;
|
||||||
block.nBits = nBits;
|
block.nBits = nBits;
|
||||||
block.nNonce = nNonce;
|
block.nNonce = nNonce;
|
||||||
|
block.proof = proof;
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,8 +412,13 @@ public:
|
||||||
READWRITE(hashMerkleRoot);
|
READWRITE(hashMerkleRoot);
|
||||||
READWRITE(nTime);
|
READWRITE(nTime);
|
||||||
READWRITE(block_height);
|
READWRITE(block_height);
|
||||||
READWRITE(nBits);
|
// For compatibility with elements 0.14 based chains
|
||||||
READWRITE(nNonce);
|
if (g_signed_blocks) {
|
||||||
|
READWRITE(proof);
|
||||||
|
} else {
|
||||||
|
READWRITE(nBits);
|
||||||
|
READWRITE(nNonce);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 GetBlockHash() const
|
uint256 GetBlockHash() const
|
||||||
|
|
@ -422,6 +431,7 @@ public:
|
||||||
block.block_height = block_height;
|
block.block_height = block_height;
|
||||||
block.nBits = nBits;
|
block.nBits = nBits;
|
||||||
block.nNonce = nNonce;
|
block.nNonce = nNonce;
|
||||||
|
block.proof = proof;
|
||||||
return block.GetHash();
|
return block.GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
|
||||||
pindexNew->nTime = diskindex.nTime;
|
pindexNew->nTime = diskindex.nTime;
|
||||||
pindexNew->nBits = diskindex.nBits;
|
pindexNew->nBits = diskindex.nBits;
|
||||||
pindexNew->nNonce = diskindex.nNonce;
|
pindexNew->nNonce = diskindex.nNonce;
|
||||||
|
pindexNew->proof = diskindex.proof;
|
||||||
pindexNew->nStatus = diskindex.nStatus;
|
pindexNew->nStatus = diskindex.nStatus;
|
||||||
pindexNew->nTx = diskindex.nTx;
|
pindexNew->nTx = diskindex.nTx;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue