diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2011-05-22 17:12:20 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2011-05-22 17:12:20 +0200 |
commit | 1c528eeee939cacc0c100e5ca1e2d4ddb3c50227 (patch) | |
tree | a515b2eba7a1ef43f1229e929ff89ec250b02395 /src | |
parent | 69a27a4ec68e7a2ea6e481b950d11f5aea42c814 (diff) | |
download | bitcoin-1c528eeee939cacc0c100e5ca1e2d4ddb3c50227.tar.xz |
Update transactions already in the wallet when rescanning.
When rescanning, if the scanned transaction is already in the wallet, it
is skipped. However, if someone sends a transaction, does not wait for
confirmation, switches wallets, waits for a block that contains his original
transaction, and switches wallets again, a rescan will leave his wallet
transaction (which has no merkle branch, so no confirmations) untouched.
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/main.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index 431c533a83..ad35708710 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -383,7 +383,7 @@ bool AppInit2(int argc, char* argv[]) { printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight); nStart = GetTimeMillis(); - ScanForWalletTransactions(pindexRescan); + ScanForWalletTransactions(pindexRescan, true); printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); } diff --git a/src/main.cpp b/src/main.cpp index 68b6b4ee1b..f030eed651 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -884,7 +884,7 @@ bool CWalletTx::AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs) return false; } -int ScanForWalletTransactions(CBlockIndex* pindexStart) +int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) { int ret = 0; @@ -897,7 +897,7 @@ int ScanForWalletTransactions(CBlockIndex* pindexStart) block.ReadFromDisk(pindex, true); BOOST_FOREACH(CTransaction& tx, block.vtx) { - if (AddToWalletIfInvolvingMe(tx, &block)) + if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) ret++; } pindex = pindex->pnext; diff --git a/src/main.h b/src/main.h index 92b73fe5ad..a49966b4d4 100644 --- a/src/main.h +++ b/src/main.h @@ -86,7 +86,7 @@ bool AddKey(const CKey& key); std::vector<unsigned char> GenerateNewKey(); bool AddToWallet(const CWalletTx& wtxIn); void WalletUpdateSpent(const COutPoint& prevout); -int ScanForWalletTransactions(CBlockIndex* pindexStart); +int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); void ReacceptWalletTransactions(); bool LoadBlockIndex(bool fAllowNew=true); void PrintBlockTree(); |