Changeset View
Changeset View
Standalone View
Standalone View
src/chain.h
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | public: | ||||
uint32_t nTime; | uint32_t nTime; | ||||
uint32_t nBits; | uint32_t nBits; | ||||
uint32_t nNonce; | uint32_t nNonce; | ||||
//! (memory only) Sequential id assigned to distinguish order in which | //! (memory only) Sequential id assigned to distinguish order in which | ||||
//! blocks are received. | //! blocks are received. | ||||
int32_t nSequenceId; | int32_t nSequenceId; | ||||
//! (memory only) block metadata | |||||
uint64_t nTimeBlockReceived; | |||||
//! (memory only) block header metadata | //! (memory only) block header metadata | ||||
uint64_t nTimeReceived; | uint64_t nTimeHeaderReceived; | ||||
//! (memory only) Maximum nTime in the chain upto and including this block. | //! (memory only) Maximum nTime in the chain upto and including this block. | ||||
unsigned int nTimeMax; | unsigned int nTimeMax; | ||||
void SetNull() { | void SetNull() { | ||||
phashBlock = nullptr; | phashBlock = nullptr; | ||||
pprev = nullptr; | pprev = nullptr; | ||||
pskip = nullptr; | pskip = nullptr; | ||||
nHeight = 0; | nHeight = 0; | ||||
nFile = 0; | nFile = 0; | ||||
nDataPos = 0; | nDataPos = 0; | ||||
nUndoPos = 0; | nUndoPos = 0; | ||||
nChainWork = arith_uint256(); | nChainWork = arith_uint256(); | ||||
nTx = 0; | nTx = 0; | ||||
nChainTx = 0; | nChainTx = 0; | ||||
nStatus = BlockStatus(); | nStatus = BlockStatus(); | ||||
nSequenceId = 0; | nSequenceId = 0; | ||||
nTimeMax = 0; | nTimeMax = 0; | ||||
nVersion = 0; | nVersion = 0; | ||||
hashMerkleRoot = uint256(); | hashMerkleRoot = uint256(); | ||||
nTime = 0; | nTime = 0; | ||||
nTimeReceived = 0; | nTimeBlockReceived = 0; | ||||
nTimeHeaderReceived = 0; | |||||
nBits = 0; | nBits = 0; | ||||
nNonce = 0; | nNonce = 0; | ||||
} | } | ||||
CBlockIndex() { SetNull(); } | CBlockIndex() { SetNull(); } | ||||
CBlockIndex(const CBlockHeader &block) { | CBlockIndex(const CBlockHeader &block) { | ||||
SetNull(); | SetNull(); | ||||
nVersion = block.nVersion; | nVersion = block.nVersion; | ||||
hashMerkleRoot = block.hashMerkleRoot; | hashMerkleRoot = block.hashMerkleRoot; | ||||
nTime = block.nTime; | nTime = block.nTime; | ||||
// Default to block time if nTimeReceived is never set, which | // Default to block time if nTime(Block/Header)Received is never set, | ||||
// which | |||||
// in effect assumes that this block is honestly mined. | // in effect assumes that this block is honestly mined. | ||||
// Note that nTimeReceived isn't written to disk, so blocks read from | // Note that nTimeReceived isn't written to disk, so blocks read from | ||||
// disk will be assumed to be honestly mined. | // disk will be assumed to be honestly mined. | ||||
nTimeReceived = block.nTime; | nTimeBlockReceived = block.nTime; | ||||
nTimeHeaderReceived = block.nTime; | |||||
deadalnix: This clearly conflicts with the goals of D2131 | |||||
nBits = block.nBits; | nBits = block.nBits; | ||||
nNonce = block.nNonce; | nNonce = block.nNonce; | ||||
} | } | ||||
CDiskBlockPos GetBlockPos() const { | CDiskBlockPos GetBlockPos() const { | ||||
CDiskBlockPos ret; | CDiskBlockPos ret; | ||||
if (nStatus.hasData()) { | if (nStatus.hasData()) { | ||||
ret.nFile = nFile; | ret.nFile = nFile; | ||||
Show All 25 Lines | public: | ||||
} | } | ||||
uint256 GetBlockHash() const { return *phashBlock; } | uint256 GetBlockHash() const { return *phashBlock; } | ||||
int64_t GetBlockTime() const { return int64_t(nTime); } | int64_t GetBlockTime() const { return int64_t(nTime); } | ||||
int64_t GetBlockTimeMax() const { return int64_t(nTimeMax); } | int64_t GetBlockTimeMax() const { return int64_t(nTimeMax); } | ||||
int64_t GetHeaderReceivedTime() const { return nTimeReceived; } | int64_t GetBlockReceivedTime() const { return nTimeBlockReceived; } | ||||
int64_t GetHeaderReceivedTime() const { return nTimeHeaderReceived; } | |||||
int64_t GetReceivedTimeDiff() const { | int64_t GetReceivedTimeDiff() const { | ||||
return GetHeaderReceivedTime() - GetBlockTime(); | return GetHeaderReceivedTime() - GetBlockTime(); | ||||
} | } | ||||
enum { nMedianTimeSpan = 11 }; | enum { nMedianTimeSpan = 11 }; | ||||
int64_t GetMedianTimePast() const { | int64_t GetMedianTimePast() const { | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |
This clearly conflicts with the goals of D2131