diff options
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 3ecd994e9d..df1eb549ad 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -8,6 +8,7 @@ #include "base58.h" #include "coincontrol.h" #include "net.h" +#include "checkpoints.h" #include <boost/algorithm/string/replace.hpp> #include <openssl/rand.h> @@ -588,7 +589,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet) bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { - LOCK(cs_wallet); + AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(hash); if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) @@ -605,9 +606,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock) { - AddToWalletIfInvolvingMe(hash, tx, pblock, true); - - if (mapWallet.count(hash) == 0) + LOCK(cs_wallet); + if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true)) return; // Not one of ours // If a transaction changes 'conflicted' state, that changes the balance @@ -830,6 +830,7 @@ bool CWalletTx::WriteToDisk() int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) { int ret = 0; + int64_t nNow = GetTime(); CBlockIndex* pindex = pindexStart; { @@ -851,6 +852,10 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) ret++; } pindex = chainActive.Next(pindex); + if (GetTime() >= nNow + 60) { + nNow = GetTime(); + LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, Checkpoints::GuessVerificationProgress(pindex)); + } } } return ret; |