Address review comments

This commit is contained in:
Jack Grigg 2016-10-16 16:26:51 -05:00
parent a581fe2aae
commit 6e263a5fd3
No known key found for this signature in database
GPG Key ID: 6A6914DAFBEA00DA
3 changed files with 9 additions and 5 deletions

View File

@ -1877,6 +1877,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
"walletpassphrase <passphrase> <timeout>\n" "walletpassphrase <passphrase> <timeout>\n"
"Stores the wallet decryption key in memory for <timeout> seconds."); "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->UpdateNullifierNoteMap();
pwalletMain->TopUpKeyPool(); pwalletMain->TopUpKeyPool();

View File

@ -890,13 +890,16 @@ bool CWallet::UpdateNullifierNoteMap()
item.first.n); item.first.n);
} }
} }
UpdateNullifierNoteMap(wtxItem.second); UpdateNullifierNoteMapWithTx(wtxItem.second);
} }
} }
return true; 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); LOCK(cs_wallet);
@ -916,7 +919,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
{ {
mapWallet[hash] = wtxIn; mapWallet[hash] = wtxIn;
mapWallet[hash].BindWallet(this); mapWallet[hash].BindWallet(this);
UpdateNullifierNoteMap(mapWallet[hash]); UpdateNullifierNoteMapWithTx(mapWallet[hash]);
AddToSpends(hash); AddToSpends(hash);
} }
else else
@ -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)); pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
CWalletTx& wtx = (*ret.first).second; CWalletTx& wtx = (*ret.first).second;
wtx.BindWallet(this); wtx.BindWallet(this);
UpdateNullifierNoteMap(wtx); UpdateNullifierNoteMapWithTx(wtx);
bool fInsertedNew = ret.second; bool fInsertedNew = ret.second;
if (fInsertedNew) if (fInsertedNew)
{ {

View File

@ -868,7 +868,7 @@ public:
void MarkDirty(); void MarkDirty();
bool UpdateNullifierNoteMap(); bool UpdateNullifierNoteMap();
void UpdateNullifierNoteMap(const CWalletTx& wtx); void UpdateNullifierNoteMapWithTx(const CWalletTx& wtx);
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb); bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb);
void SyncTransaction(const CTransaction& tx, const CBlock* pblock); void SyncTransaction(const CTransaction& tx, const CBlock* pblock);
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate); bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate);