diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-01-07 22:35:47 -0800 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-01-15 08:42:00 -0800 |
commit | d93c4c1d6e0aab5f32306ecd7c1237257b26940d (patch) | |
tree | e11259962b2fdb58049057658bf924b4266ba892 /src/interfaces/chain.cpp | |
parent | 700c42b85d20e624bef4228eef062c93084efab5 (diff) |
Add time methods to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code
This commit does not change behavior.
Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
Diffstat (limited to 'src/interfaces/chain.cpp')
-rw-r--r-- | src/interfaces/chain.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 138d1bfd5f..ca2533bb1d 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -46,6 +46,18 @@ class LockImpl : public Chain::Lock assert(block != nullptr); return block->GetBlockHash(); } + int64_t getBlockTime(int height) override + { + CBlockIndex* block = ::chainActive[height]; + assert(block != nullptr); + return block->GetBlockTime(); + } + int64_t getBlockMedianTimePast(int height) override + { + CBlockIndex* block = ::chainActive[height]; + assert(block != nullptr); + return block->GetMedianTimePast(); + } }; class LockingStateImpl : public LockImpl, public UniqueLock<CCriticalSection> |