Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Oct 16, 2016
1 parent a581fe2 commit 6e263a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
"walletpassphrase <passphrase> <timeout>\n"
"Stores the wallet decryption key in memory for <timeout> seconds.");

// No need to check return values, because the wallet was unlocked above
pwalletMain->UpdateNullifierNoteMap();
pwalletMain->TopUpKeyPool();

Expand Down
11 changes: 7 additions & 4 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,16 @@ bool CWallet::UpdateNullifierNoteMap()
item.first.n);
}
}
UpdateNullifierNoteMap(wtxItem.second);
UpdateNullifierNoteMapWithTx(wtxItem.second);
}
}
return true;
}

void CWallet::UpdateNullifierNoteMap(const CWalletTx& wtx)
/**
* Update mapNullifiersToNotes with the cached nullifiers in this tx.
*/
void CWallet::UpdateNullifierNoteMapWithTx(const CWalletTx& wtx)
{
{
LOCK(cs_wallet);
Expand All @@ -916,7 +919,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
{
mapWallet[hash] = wtxIn;
mapWallet[hash].BindWallet(this);
UpdateNullifierNoteMap(mapWallet[hash]);
UpdateNullifierNoteMapWithTx(mapWallet[hash]);
AddToSpends(hash);
}
else
Expand All @@ -926,7 +929,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
CWalletTx& wtx = (*ret.first).second;
wtx.BindWallet(this);
UpdateNullifierNoteMap(wtx);
UpdateNullifierNoteMapWithTx(wtx);
bool fInsertedNew = ret.second;
if (fInsertedNew)
{
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface

void MarkDirty();
bool UpdateNullifierNoteMap();
void UpdateNullifierNoteMap(const CWalletTx& wtx);
void UpdateNullifierNoteMapWithTx(const CWalletTx& wtx);
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb);
void SyncTransaction(const CTransaction& tx, const CBlock* pblock);
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate);
Expand Down

0 comments on commit 6e263a5

Please sign in to comment.