Rename FindMyNotes to FindMySproutNotes.
This commit is contained in:
@@ -381,7 +381,7 @@ TEST(wallet_tests, GetNoteNullifier) {
|
|||||||
EXPECT_EQ(nullifier, ret);
|
EXPECT_EQ(nullifier, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(wallet_tests, FindMyNotes) {
|
TEST(wallet_tests, FindMySproutNotes) {
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
|
|
||||||
auto sk = libzcash::SproutSpendingKey::random();
|
auto sk = libzcash::SproutSpendingKey::random();
|
||||||
@@ -392,12 +392,12 @@ TEST(wallet_tests, FindMyNotes) {
|
|||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto noteMap = wallet.FindMyNotes(wtx);
|
auto noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
EXPECT_EQ(0, noteMap.size());
|
EXPECT_EQ(0, noteMap.size());
|
||||||
|
|
||||||
wallet.AddSproutSpendingKey(sk);
|
wallet.AddSproutSpendingKey(sk);
|
||||||
|
|
||||||
noteMap = wallet.FindMyNotes(wtx);
|
noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
EXPECT_EQ(2, noteMap.size());
|
EXPECT_EQ(2, noteMap.size());
|
||||||
|
|
||||||
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
||||||
@@ -406,7 +406,7 @@ TEST(wallet_tests, FindMyNotes) {
|
|||||||
EXPECT_EQ(nd, noteMap[jsoutpt]);
|
EXPECT_EQ(nd, noteMap[jsoutpt]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
|
TEST(wallet_tests, FindMySproutNotesInEncryptedWallet) {
|
||||||
TestWallet wallet;
|
TestWallet wallet;
|
||||||
uint256 r {GetRandHash()};
|
uint256 r {GetRandHash()};
|
||||||
CKeyingMaterial vMasterKey (r.begin(), r.end());
|
CKeyingMaterial vMasterKey (r.begin(), r.end());
|
||||||
@@ -420,7 +420,7 @@ TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
|
|||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
auto nullifier = note.nullifier(sk);
|
||||||
|
|
||||||
auto noteMap = wallet.FindMyNotes(wtx);
|
auto noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
EXPECT_EQ(2, noteMap.size());
|
EXPECT_EQ(2, noteMap.size());
|
||||||
|
|
||||||
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
||||||
@@ -430,7 +430,7 @@ TEST(wallet_tests, FindMyNotesInEncryptedWallet) {
|
|||||||
|
|
||||||
ASSERT_TRUE(wallet.Unlock(vMasterKey));
|
ASSERT_TRUE(wallet.Unlock(vMasterKey));
|
||||||
|
|
||||||
noteMap = wallet.FindMyNotes(wtx);
|
noteMap = wallet.FindMySproutNotes(wtx);
|
||||||
EXPECT_EQ(2, noteMap.size());
|
EXPECT_EQ(2, noteMap.size());
|
||||||
EXPECT_EQ(1, noteMap.count(jsoutpt));
|
EXPECT_EQ(1, noteMap.count(jsoutpt));
|
||||||
EXPECT_EQ(nd, noteMap[jsoutpt]);
|
EXPECT_EQ(nd, noteMap[jsoutpt]);
|
||||||
@@ -1038,7 +1038,7 @@ TEST(wallet_tests, UpdateNullifierNoteMap) {
|
|||||||
auto note = GetNote(sk, wtx, 0, 1);
|
auto note = GetNote(sk, wtx, 0, 1);
|
||||||
auto nullifier = note.nullifier(sk);
|
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;
|
mapSproutNoteData_t noteData;
|
||||||
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
JSOutPoint jsoutpt {wtx.GetHash(), 0, 1};
|
||||||
SproutNoteData nd {sk.address()};
|
SproutNoteData nd {sk.address()};
|
||||||
|
|||||||
@@ -1333,7 +1333,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
|||||||
AssertLockHeld(cs_wallet);
|
AssertLockHeld(cs_wallet);
|
||||||
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
|
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
|
||||||
if (fExisted && !fUpdate) return false;
|
if (fExisted && !fUpdate) return false;
|
||||||
auto noteData = FindMyNotes(tx);
|
auto noteData = FindMySproutNotes(tx);
|
||||||
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
|
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
|
||||||
{
|
{
|
||||||
CWalletTx wtx(this,tx);
|
CWalletTx wtx(this,tx);
|
||||||
@@ -1432,10 +1432,10 @@ boost::optional<uint256> CWallet::GetNoteNullifier(const JSDescription& jsdesc,
|
|||||||
* PaymentAddresses in this wallet.
|
* PaymentAddresses in this wallet.
|
||||||
*
|
*
|
||||||
* It should never be necessary to call this method with a CWalletTx, because
|
* 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.
|
* 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);
|
LOCK(cs_SpendingKeyStore);
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
@@ -1465,7 +1465,7 @@ mapSproutNoteData_t CWallet::FindMyNotes(const CTransaction& tx) const
|
|||||||
// Couldn't decrypt with this decryptor
|
// Couldn't decrypt with this decryptor
|
||||||
} catch (const std::exception &exc) {
|
} catch (const std::exception &exc) {
|
||||||
// Unexpected failure
|
// Unexpected failure
|
||||||
LogPrintf("FindMyNotes(): Unexpected error while testing decrypt:\n");
|
LogPrintf("FindMySproutNotes(): Unexpected error while testing decrypt:\n");
|
||||||
LogPrintf("%s\n", exc.what());
|
LogPrintf("%s\n", exc.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1680,7 +1680,7 @@ void CWalletTx::SetSproutNoteData(mapSproutNoteData_t ¬eData)
|
|||||||
// Store the address and nullifier for the Note
|
// Store the address and nullifier for the Note
|
||||||
mapSproutNoteData[nd.first] = nd.second;
|
mapSproutNoteData[nd.first] = nd.second;
|
||||||
} else {
|
} else {
|
||||||
// If FindMyNotes() was used to obtain noteData,
|
// If FindMySproutNotes() was used to obtain noteData,
|
||||||
// this should never happen
|
// this should never happen
|
||||||
throw std::logic_error("CWalletTx::SetSproutNoteData(): Invalid note");
|
throw std::logic_error("CWalletTx::SetSproutNoteData(): Invalid note");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Block height corresponding to the most current witness.
|
* 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
|
* -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
|
* 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
|
* if no witnesses were cached), and so can set the correct value in
|
||||||
@@ -1082,7 +1082,7 @@ public:
|
|||||||
const ZCNoteDecryption& dec,
|
const ZCNoteDecryption& dec,
|
||||||
const uint256& hSig,
|
const uint256& hSig,
|
||||||
uint8_t n) const;
|
uint8_t n) const;
|
||||||
mapSproutNoteData_t FindMyNotes(const CTransaction& tx) const;
|
mapSproutNoteData_t FindMySproutNotes(const CTransaction& tx) const;
|
||||||
bool IsFromMe(const uint256& nullifier) const;
|
bool IsFromMe(const uint256& nullifier) const;
|
||||||
void GetSproutNoteWitnesses(
|
void GetSproutNoteWitnesses(
|
||||||
std::vector<JSOutPoint> notes,
|
std::vector<JSOutPoint> notes,
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ double benchmark_try_decrypt_notes(size_t nAddrs)
|
|||||||
|
|
||||||
struct timeval tv_start;
|
struct timeval tv_start;
|
||||||
timer_start(tv_start);
|
timer_start(tv_start);
|
||||||
auto nd = wallet.FindMyNotes(tx);
|
auto nd = wallet.FindMySproutNotes(tx);
|
||||||
return timer_stop(tv_start);
|
return timer_stop(tv_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user