Rename FindMyNotes to FindMySproutNotes.

This commit is contained in:
Simon 2018-07-25 17:12:03 -07:00
parent 40f320e0ee
commit 57faf44e61
4 changed files with 15 additions and 15 deletions

View File

@ -381,7 +381,7 @@ TEST(wallet_tests, GetNoteNullifier) {
EXPECT_EQ(nullifier, ret);
}
TEST(wallet_tests, FindMyNotes) {
TEST(wallet_tests, FindMySproutNotes) {
CWallet wallet;
auto sk = libzcash::SproutSpendingKey::random();
@ -392,12 +392,12 @@ TEST(wallet_tests, FindMyNotes) {
auto note = GetNote(sk, wtx, 0, 1);
auto nullifier = note.nullifier(sk);
auto noteMap = wallet.FindMyNotes(wtx);
auto noteMap = wallet.FindMySproutNotes(wtx);
EXPECT_EQ(0, noteMap.size());
wallet.AddSproutSpendingKey(sk);
noteMap = wallet.FindMyNotes(wtx);
noteMap = wallet.FindMySproutNotes(wtx);
EXPECT_EQ(2, noteMap.size());
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
@ -406,7 +406,7 @@ TEST(wallet_tests, FindMyNotes) {
EXPECT_EQ(nd, noteMap[jsoutpt]);
}
TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
TEST(wallet_tests, FindMySproutNotesInEncryptedWallet) {
TestWallet wallet;
uint256 r {GetRandHash()};
CKeyingMaterial vMasterKey (r.begin(), r.end());
@ -420,7 +420,7 @@ TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
auto note = GetNote(sk, wtx, 0, 1);
auto nullifier = note.nullifier(sk);
auto noteMap = wallet.FindMyNotes(wtx);
auto noteMap = wallet.FindMySproutNotes(wtx);
EXPECT_EQ(2, noteMap.size());
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
@ -430,7 +430,7 @@ TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
ASSERT_TRUE(wallet.Unlock(vMasterKey));
noteMap = wallet.FindMyNotes(wtx);
noteMap = wallet.FindMySproutNotes(wtx);
EXPECT_EQ(2, noteMap.size());
EXPECT_EQ(1, noteMap.count(jsoutpt));
EXPECT_EQ(nd, noteMap[jsoutpt]);
@ -1038,7 +1038,7 @@ TEST(wallet_tests, UpdateNullifierNoteMap) {
auto note = GetNote(sk, wtx, 0, 1);
auto nullifier = note.nullifier(sk);
// Pretend that we called FindMyNotes while the wallet was locked
// Pretend that we called FindMySproutNotes while the wallet was locked
mapSproutNoteData_t noteData;
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
SproutNoteData nd {sk.address()};

View File

@ -1333,7 +1333,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
AssertLockHeld(cs_wallet);
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
if (fExisted && !fUpdate) return false;
auto noteData = FindMyNotes(tx);
auto noteData = FindMySproutNotes(tx);
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
{
CWalletTx wtx(this,tx);
@ -1432,10 +1432,10 @@ boost::optional<uint256> CWallet::GetNoteNullifier(const JSDescription& jsdesc,
* PaymentAddresses in this wallet.
*
* It should never be necessary to call this method with a CWalletTx, because
* the result of FindMyNotes (for the addresses available at the time) will
* the result of FindMySproutNotes (for the addresses available at the time) will
* already have been cached in CWalletTx.mapSproutNoteData.
*/
mapSproutNoteData_t CWallet::FindMyNotes(const CTransaction& tx) const
mapSproutNoteData_t CWallet::FindMySproutNotes(const CTransaction &tx) const
{
LOCK(cs_SpendingKeyStore);
uint256 hash = tx.GetHash();
@ -1465,7 +1465,7 @@ mapSproutNoteData_t CWallet::FindMyNotes(const CTransaction& tx) const
// Couldn't decrypt with this decryptor
} catch (const std::exception &exc) {
// Unexpected failure
LogPrintf("FindMyNotes(): Unexpected error while testing decrypt:\n");
LogPrintf("FindMySproutNotes(): Unexpected error while testing decrypt:\n");
LogPrintf("%s\n", exc.what());
}
}
@ -1680,7 +1680,7 @@ void CWalletTx::SetSproutNoteData(mapSproutNoteData_t &noteData)
// Store the address and nullifier for the Note
mapSproutNoteData[nd.first] = nd.second;
} else {
// If FindMyNotes() was used to obtain noteData,
// If FindMySproutNotes() was used to obtain noteData,
// this should never happen
throw std::logic_error("CWalletTx::SetSproutNoteData(): Invalid note");
}

View File

@ -225,7 +225,7 @@ public:
/**
* Block height corresponding to the most current witness.
*
* When we first create a SproutNoteData in CWallet::FindMyNotes, this is set to
* When we first create a SproutNoteData in CWallet::FindMySproutNotes, this is set to
* -1 as a placeholder. The next time CWallet::ChainTip is called, we can
* determine what height the witness cache for this note is valid for (even
* if no witnesses were cached), and so can set the correct value in
@ -1082,7 +1082,7 @@ public:
const ZCNoteDecryption& dec,
const uint256& hSig,
uint8_t n) const;
mapSproutNoteData_t FindMyNotes(const CTransaction& tx) const;
mapSproutNoteData_t FindMySproutNotes(const CTransaction& tx) const;
bool IsFromMe(const uint256& nullifier) const;
void GetSproutNoteWitnesses(
std::vector<JSOutPoint> notes,

View File

@ -291,7 +291,7 @@ double benchmark_try_decrypt_notes(size_t nAddrs)
struct timeval tv_start;
timer_start(tv_start);
auto nd = wallet.FindMyNotes(tx);
auto nd = wallet.FindMySproutNotes(tx);
return timer_stop(tv_start);
}