Fix GetFilteredNotes to use int for minDepth like upstream and avoid casting problems. Don't use FindMyNotes as mapNoteData has already been set on wallet tx.

This commit is contained in:
Simon 2016-09-27 11:14:49 -07:00
parent c470cdf70b
commit dec49d1f82
3 changed files with 6 additions and 8 deletions

View File

@ -2833,7 +2833,7 @@ Value z_listaddresses(const Array& params, bool fHelp)
return ret; return ret;
} }
CAmount getBalanceTaddr(std::string transparentAddress, size_t minDepth=1) { CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1) {
set<CBitcoinAddress> setAddress; set<CBitcoinAddress> setAddress;
vector<COutput> vecOutputs; vector<COutput> vecOutputs;
CAmount balance = 0; CAmount balance = 0;
@ -2872,7 +2872,7 @@ CAmount getBalanceTaddr(std::string transparentAddress, size_t minDepth=1) {
return balance; return balance;
} }
CAmount getBalanceZaddr(std::string address, size_t minDepth = 1) { CAmount getBalanceZaddr(std::string address, int minDepth = 1) {
CAmount balance = 0; CAmount balance = 0;
std::vector<CNotePlaintextEntry> entries; std::vector<CNotePlaintextEntry> entries;
LOCK2(cs_main, pwalletMain->cs_wallet); LOCK2(cs_main, pwalletMain->cs_wallet);

View File

@ -3187,7 +3187,7 @@ bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectAbsurdFee)
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectAbsurdFee); return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectAbsurdFee);
} }
bool CWallet::GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, std::string address, size_t minDepth = 1, bool ignoreSpent) bool CWallet::GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, std::string address, int minDepth, bool ignoreSpent)
{ {
bool fFilterAddress = false; bool fFilterAddress = false;
libzcash::PaymentAddress filterPaymentAddress; libzcash::PaymentAddress filterPaymentAddress;
@ -3206,13 +3206,11 @@ bool CWallet::GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, st
continue; continue;
} }
mapNoteData_t mapNoteData = FindMyNotes(wtx); if (wtx.mapNoteData.size() == 0) {
if (mapNoteData.size() == 0) {
continue; continue;
} }
for (auto & pair : mapNoteData) { for (auto & pair : wtx.mapNoteData) {
JSOutPoint jsop = pair.first; JSOutPoint jsop = pair.first;
CNoteData nd = pair.second; CNoteData nd = pair.second;
PaymentAddress pa = nd.address; PaymentAddress pa = nd.address;

View File

@ -905,7 +905,7 @@ public:
void SetBroadcastTransactions(bool broadcast) { fBroadcastTransactions = broadcast; } void SetBroadcastTransactions(bool broadcast) { fBroadcastTransactions = broadcast; }
/* Find notes filtered by payment address, min depth, ability to spend */ /* Find notes filtered by payment address, min depth, ability to spend */
bool GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, std::string address, size_t minDepth, bool ignoreSpent=true); bool GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, std::string address, int minDepth=1, bool ignoreSpent=true);
}; };