From dec49d1f8226d02445912ce255d3d66dbdab7caa Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 27 Sep 2016 11:14:49 -0700 Subject: [PATCH] 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. --- src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/wallet.cpp | 8 +++----- src/wallet/wallet.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0fc34966b..ba04bdfe9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2833,7 +2833,7 @@ Value z_listaddresses(const Array& params, bool fHelp) return ret; } -CAmount getBalanceTaddr(std::string transparentAddress, size_t minDepth=1) { +CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1) { set setAddress; vector vecOutputs; CAmount balance = 0; @@ -2872,7 +2872,7 @@ CAmount getBalanceTaddr(std::string transparentAddress, size_t minDepth=1) { return balance; } -CAmount getBalanceZaddr(std::string address, size_t minDepth = 1) { +CAmount getBalanceZaddr(std::string address, int minDepth = 1) { CAmount balance = 0; std::vector entries; LOCK2(cs_main, pwalletMain->cs_wallet); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 2e1449fc2..e0b2e52a2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3187,7 +3187,7 @@ bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectAbsurdFee) return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectAbsurdFee); } -bool CWallet::GetFilteredNotes(std::vector & outEntries, std::string address, size_t minDepth = 1, bool ignoreSpent) +bool CWallet::GetFilteredNotes(std::vector & outEntries, std::string address, int minDepth, bool ignoreSpent) { bool fFilterAddress = false; libzcash::PaymentAddress filterPaymentAddress; @@ -3206,13 +3206,11 @@ bool CWallet::GetFilteredNotes(std::vector & outEntries, st continue; } - mapNoteData_t mapNoteData = FindMyNotes(wtx); - - if (mapNoteData.size() == 0) { + if (wtx.mapNoteData.size() == 0) { continue; } - for (auto & pair : mapNoteData) { + for (auto & pair : wtx.mapNoteData) { JSOutPoint jsop = pair.first; CNoteData nd = pair.second; PaymentAddress pa = nd.address; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 1bfb75792..b130705ee 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -905,7 +905,7 @@ public: void SetBroadcastTransactions(bool broadcast) { fBroadcastTransactions = broadcast; } /* Find notes filtered by payment address, min depth, ability to spend */ - bool GetFilteredNotes(std::vector & outEntries, std::string address, size_t minDepth, bool ignoreSpent=true); + bool GetFilteredNotes(std::vector & outEntries, std::string address, int minDepth=1, bool ignoreSpent=true); };