aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-01-18 17:59:10 +0100
committerpracticalswift <practicalswift@users.noreply.github.com>2017-02-28 16:54:43 +0100
commit343ba8fef586906fa8e7985e3cdec9ae390b475a (patch)
tree26ef166317e7c2dd360893d359f472a0c0d09e0e /src
parent7e2a2212ecac41bf4a4fd9f2de6b4cd258938497 (diff)
downloadbitcoin-343ba8fef586906fa8e7985e3cdec9ae390b475a.tar.xz
[wallet] Remove redundant initialization
Prior to this commit pindexRescan was initialized to a chainActive.Tip(). However, the value of pindexRescan set at time of initialization was never read before pindexRescan was being set to either chainActive.Genesis() (case 1), FindForkInGlobalIndex(chainActive, locator) (case 2) or chainActive.Genesis() (case 3). Thus, the initialization was redundant. This commit a.) removes the redundant initialization and b.) simplifies this logic so that pindexRescan is initialized to chainActive.Genesis() (case 1 and 3), and set to FindForkInGlobalIndex(chainActive, locator) (case 2) as needed.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 63501b04be..67fc1c0639 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3681,17 +3681,13 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
RegisterValidationInterface(walletInstance);
- CBlockIndex *pindexRescan = chainActive.Tip();
- if (GetBoolArg("-rescan", false))
- pindexRescan = chainActive.Genesis();
- else
+ CBlockIndex *pindexRescan = chainActive.Genesis();
+ if (!GetBoolArg("-rescan", false))
{
CWalletDB walletdb(walletFile);
CBlockLocator locator;
if (walletdb.ReadBestBlock(locator))
pindexRescan = FindForkInGlobalIndex(chainActive, locator);
- else
- pindexRescan = chainActive.Genesis();
}
if (chainActive.Tip() && chainActive.Tip() != pindexRescan)
{