Browse Source

AddToWallet implies BindWallet

Now that AddToWallet is called when loading transactions from the
wallet database, BindWallet can be integrated into that and does not
need to be an extra step.

Leaves behaviour unchanged, but makes the
fFromLoadWallet/!fFromLoadWallet paths in AddToWallet a bit more
symmetric.
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
09ec3af166
  1. 1
      src/wallet.cpp
  2. 4
      src/walletdb.cpp

1
src/wallet.cpp

@ -470,6 +470,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
if (fFromLoadWallet) if (fFromLoadWallet)
{ {
mapWallet[hash] = wtxIn; mapWallet[hash] = wtxIn;
mapWallet[hash].BindWallet(this);
AddToSpends(hash); AddToSpends(hash);
} }
else else

4
src/walletdb.cpp

@ -352,9 +352,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
CWalletTx wtx; CWalletTx wtx;
ssValue >> wtx; ssValue >> wtx;
CValidationState state; CValidationState state;
if (CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid()) if (!(CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid()))
wtx.BindWallet(pwallet);
else
return false; return false;
// Undo serialize changes in 31600 // Undo serialize changes in 31600

Loading…
Cancel
Save