diff options
| author | Russell Yanofsky <[email protected]> | 2019-01-07 22:56:46 -0800 |
|---|---|---|
| committer | Russell Yanofsky <[email protected]> | 2019-01-15 08:42:00 -0800 |
| commit | 2ffb07929ef480bd114defdc10b6a84463f222be (patch) | |
| tree | 49199da132e8043f486a6d9702b2b22bdda9a9fc /src/wallet/wallet.cpp | |
| parent | Add time methods to the Chain interface (diff) | |
| download | discoin-2ffb07929ef480bd114defdc10b6a84463f222be.tar.xz discoin-2ffb07929ef480bd114defdc10b6a84463f222be.zip | |
Add findFork and findBlock 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 <[email protected]>
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 35660372c..32275c618 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3775,7 +3775,8 @@ unsigned int CWallet::ComputeTimeSmart(const CWalletTx& wtx) const { unsigned int nTimeSmart = wtx.nTimeReceived; if (!wtx.hashUnset()) { - if (const CBlockIndex* pindex = LookupBlockIndex(wtx.hashBlock)) { + int64_t blocktime; + if (chain().findBlock(wtx.hashBlock, nullptr /* block */, &blocktime)) { int64_t latestNow = wtx.nTimeReceived; int64_t latestEntry = 0; @@ -3801,7 +3802,6 @@ unsigned int CWallet::ComputeTimeSmart(const CWalletTx& wtx) const } } - int64_t blocktime = pindex->GetBlockTime(); nTimeSmart = std::max(latestEntry, std::min(blocktime, latestNow)); } else { WalletLogPrintf("%s: found %s in block %s not in index\n", __func__, wtx.GetHash().ToString(), wtx.hashBlock.ToString()); |