Add functionality from GetUnspentFilteredNotes to GetFilteredNotes
This commit is contained in:
@@ -4362,7 +4362,7 @@ void CWallet::GetFilteredNotes(
|
|||||||
std::string address,
|
std::string address,
|
||||||
int minDepth,
|
int minDepth,
|
||||||
bool ignoreSpent,
|
bool ignoreSpent,
|
||||||
bool ignoreUnspendable)
|
bool requireSpendingKey)
|
||||||
{
|
{
|
||||||
std::set<PaymentAddress> filterAddresses;
|
std::set<PaymentAddress> filterAddresses;
|
||||||
|
|
||||||
@@ -4370,7 +4370,7 @@ void CWallet::GetFilteredNotes(
|
|||||||
filterAddresses.insert(DecodePaymentAddress(address));
|
filterAddresses.insert(DecodePaymentAddress(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, ignoreSpent, ignoreUnspendable);
|
GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, INT_MAX, ignoreSpent, requireSpendingKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4382,8 +4382,10 @@ void CWallet::GetFilteredNotes(
|
|||||||
std::vector<SaplingNoteEntry>& saplingEntries,
|
std::vector<SaplingNoteEntry>& saplingEntries,
|
||||||
std::set<PaymentAddress>& filterAddresses,
|
std::set<PaymentAddress>& filterAddresses,
|
||||||
int minDepth,
|
int minDepth,
|
||||||
|
int maxDepth,
|
||||||
bool ignoreSpent,
|
bool ignoreSpent,
|
||||||
bool ignoreUnspendable)
|
bool requireSpendingKey,
|
||||||
|
bool ignoreLocked)
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
|
||||||
@@ -4391,7 +4393,7 @@ void CWallet::GetFilteredNotes(
|
|||||||
CWalletTx wtx = p.second;
|
CWalletTx wtx = p.second;
|
||||||
|
|
||||||
// Filter the transactions before checking for notes
|
// Filter the transactions before checking for notes
|
||||||
if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth) {
|
if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth || wtx.GetDepthInMainChain() > maxDepth) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4411,12 +4413,12 @@ void CWallet::GetFilteredNotes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip notes which cannot be spent
|
// skip notes which cannot be spent
|
||||||
if (ignoreUnspendable && !HaveSproutSpendingKey(pa)) {
|
if (requireSpendingKey && !HaveSproutSpendingKey(pa)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip locked notes
|
// skip locked notes
|
||||||
if (IsLockedNote(jsop)) {
|
if (ignoreLocked && IsLockedNote(jsop)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4477,7 +4479,7 @@ void CWallet::GetFilteredNotes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip notes which cannot be spent
|
// skip notes which cannot be spent
|
||||||
if (ignoreUnspendable) {
|
if (requireSpendingKey) {
|
||||||
libzcash::SaplingIncomingViewingKey ivk;
|
libzcash::SaplingIncomingViewingKey ivk;
|
||||||
libzcash::SaplingFullViewingKey fvk;
|
libzcash::SaplingFullViewingKey fvk;
|
||||||
if (!(GetSaplingIncomingViewingKey(pa, ivk) &&
|
if (!(GetSaplingIncomingViewingKey(pa, ivk) &&
|
||||||
@@ -4489,7 +4491,7 @@ void CWallet::GetFilteredNotes(
|
|||||||
|
|
||||||
// skip locked notes
|
// skip locked notes
|
||||||
// TODO: Add locking for Sapling notes
|
// TODO: Add locking for Sapling notes
|
||||||
// if (IsLockedNote(jsop)) {
|
// if (ignoreLocked && IsLockedNote(op)) {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@@ -1279,15 +1279,17 @@ public:
|
|||||||
std::string address,
|
std::string address,
|
||||||
int minDepth=1,
|
int minDepth=1,
|
||||||
bool ignoreSpent=true,
|
bool ignoreSpent=true,
|
||||||
bool ignoreUnspendable=true);
|
bool requireSpendingKey=true);
|
||||||
|
|
||||||
/* Find notes filtered by payment addresses, min depth, ability to spend */
|
/* Find notes filtered by payment addresses, min depth, ability to spend */
|
||||||
void GetFilteredNotes(std::vector<CSproutNotePlaintextEntry>& sproutEntries,
|
void GetFilteredNotes(std::vector<CSproutNotePlaintextEntry>& sproutEntries,
|
||||||
std::vector<SaplingNoteEntry>& saplingEntries,
|
std::vector<SaplingNoteEntry>& saplingEntries,
|
||||||
std::set<libzcash::PaymentAddress>& filterAddresses,
|
std::set<libzcash::PaymentAddress>& filterAddresses,
|
||||||
int minDepth=1,
|
int minDepth=1,
|
||||||
|
int maxDepth=INT_MAX,
|
||||||
bool ignoreSpent=true,
|
bool ignoreSpent=true,
|
||||||
bool ignoreUnspendable=true);
|
bool requireSpendingKey=true,
|
||||||
|
bool ignoreLocked=true);
|
||||||
|
|
||||||
/* Find unspent notes filtered by payment address, min depth and max depth */
|
/* Find unspent notes filtered by payment address, min depth and max depth */
|
||||||
void GetUnspentFilteredNotes(std::vector<CSproutNotePlaintextEntry>& sproutEntries,
|
void GetUnspentFilteredNotes(std::vector<CSproutNotePlaintextEntry>& sproutEntries,
|
||||||
|
|||||||
Reference in New Issue
Block a user