Skip to content

Commit 09ec3af

Browse files
committed
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.
1 parent c7c3262 commit 09ec3af

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/wallet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
470470
if (fFromLoadWallet)
471471
{
472472
mapWallet[hash] = wtxIn;
473+
mapWallet[hash].BindWallet(this);
473474
AddToSpends(hash);
474475
}
475476
else

src/walletdb.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
352352
CWalletTx wtx;
353353
ssValue >> wtx;
354354
CValidationState state;
355-
if (CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid())
356-
wtx.BindWallet(pwallet);
357-
else
355+
if (!(CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid()))
358356
return false;
359357

360358
// Undo serialize changes in 31600

0 commit comments

Comments
 (0)