diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-01-13 15:48:28 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-01-13 16:06:05 -0800 |
commit | e126d0c12ca66278d9e7b12187c5ff4fc02a7e6c (patch) | |
tree | ffbb05a46f5727d1a6f653682288af9600869938 /src/chain.h | |
parent | 3908fc4728059719bed0e1c7b1c8b388c2d4a8da (diff) | |
parent | 4b06e41c309123c4eefce0d3578c01efe1ae10df (diff) | |
download | bitcoin-e126d0c12ca66278d9e7b12187c5ff4fc02a7e6c.tar.xz |
Merge #9490: Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
4b06e41 Add unit test for FindEarliestAtLeast (Suhas Daftuar)
997a98a Replace FindLatestBefore used by importmuti with FindEarliestAtLeast. (Gregory Maxwell)
Diffstat (limited to 'src/chain.h')
-rw-r--r-- | src/chain.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/chain.h b/src/chain.h index 989a71958c..acb29b667b 100644 --- a/src/chain.h +++ b/src/chain.h @@ -202,6 +202,9 @@ public: //! (memory only) Sequential id assigned to distinguish order in which blocks are received. int32_t nSequenceId; + //! (memory only) Maximum nTime in the chain upto and including this block. + unsigned int nTimeMax; + void SetNull() { phashBlock = NULL; @@ -216,6 +219,7 @@ public: nChainTx = 0; nStatus = 0; nSequenceId = 0; + nTimeMax = 0; nVersion = 0; hashMerkleRoot = uint256(); @@ -281,6 +285,11 @@ public: return (int64_t)nTime; } + int64_t GetBlockTimeMax() const + { + return (int64_t)nTimeMax; + } + enum { nMedianTimeSpan=11 }; int64_t GetMedianTimePast() const @@ -461,8 +470,8 @@ public: /** Find the last common block between this chain and a block index entry. */ const CBlockIndex *FindFork(const CBlockIndex *pindex) const; - /** Find the most recent block with timestamp lower than the given. */ - CBlockIndex* FindLatestBefore(int64_t nTime) const; + /** Find the earliest block with timestamp equal or greater than the given. */ + CBlockIndex* FindEarliestAtLeast(int64_t nTime) const; }; #endif // BITCOIN_CHAIN_H |