Revert the move of the `getBalanceZaddr` block for ease of review.
This commit is contained in:
parent
35961c4ee2
commit
4c4a1c4d68
|
@ -2331,27 +2331,7 @@ UniValue settxfee(const UniValue& params, bool fHelp)
|
|||
return true;
|
||||
}
|
||||
|
||||
CAmount getBalanceZaddr(std::string address, int minDepth = 1, int maxDepth = INT_MAX, bool ignoreUnspendable=true) {
|
||||
CAmount balance = 0;
|
||||
std::vector<SproutNoteEntry> sproutEntries;
|
||||
std::vector<SaplingNoteEntry> saplingEntries;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
std::set<PaymentAddress> filterAddresses;
|
||||
if (address.length() > 0) {
|
||||
KeyIO keyIO(Params());
|
||||
filterAddresses.insert(keyIO.DecodePaymentAddress(address));
|
||||
}
|
||||
|
||||
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, maxDepth, true, ignoreUnspendable);
|
||||
for (auto & entry : sproutEntries) {
|
||||
balance += CAmount(entry.note.value());
|
||||
}
|
||||
for (auto & entry : saplingEntries) {
|
||||
balance += CAmount(entry.note.value());
|
||||
}
|
||||
return balance;
|
||||
}
|
||||
CAmount getBalanceZaddr(std::string address, int minDepth = 1, int maxDepth = INT_MAX, bool ignoreUnspendable=true);
|
||||
|
||||
UniValue getwalletinfo(const UniValue& params, bool fHelp)
|
||||
{
|
||||
|
@ -2655,11 +2635,11 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
|||
// User did not provide zaddrs, so use default i.e. all addresses
|
||||
std::set<libzcash::SproutPaymentAddress> sproutzaddrs = {};
|
||||
pwalletMain->GetSproutPaymentAddresses(sproutzaddrs);
|
||||
|
||||
|
||||
// Sapling support
|
||||
std::set<libzcash::SaplingPaymentAddress> saplingzaddrs = {};
|
||||
pwalletMain->GetSaplingPaymentAddresses(saplingzaddrs);
|
||||
|
||||
|
||||
zaddrs.insert(sproutzaddrs.begin(), sproutzaddrs.end());
|
||||
zaddrs.insert(saplingzaddrs.begin(), saplingzaddrs.end());
|
||||
}
|
||||
|
@ -2671,7 +2651,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
|||
std::vector<SaplingNoteEntry> saplingEntries;
|
||||
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, true, !fIncludeWatchonly, false);
|
||||
std::set<std::pair<PaymentAddress, uint256>> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs);
|
||||
|
||||
|
||||
for (auto & entry : sproutEntries) {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.pushKV("txid", entry.jsop.hash.ToString());
|
||||
|
@ -3399,6 +3379,28 @@ CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1, bool ign
|
|||
return balance;
|
||||
}
|
||||
|
||||
CAmount getBalanceZaddr(std::string address, int minDepth = 1, int maxDepth = INT_MAX, bool ignoreUnspendable=true) {
|
||||
CAmount balance = 0;
|
||||
std::vector<SproutNoteEntry> sproutEntries;
|
||||
std::vector<SaplingNoteEntry> saplingEntries;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
std::set<PaymentAddress> filterAddresses;
|
||||
if (address.length() > 0) {
|
||||
KeyIO keyIO(Params());
|
||||
filterAddresses.insert(keyIO.DecodePaymentAddress(address));
|
||||
}
|
||||
|
||||
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, maxDepth, true, ignoreUnspendable);
|
||||
for (auto & entry : sproutEntries) {
|
||||
balance += CAmount(entry.note.value());
|
||||
}
|
||||
for (auto & entry : saplingEntries) {
|
||||
balance += CAmount(entry.note.value());
|
||||
}
|
||||
return balance;
|
||||
}
|
||||
|
||||
struct txblock
|
||||
{
|
||||
int height = 0;
|
||||
|
@ -4284,7 +4286,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
|||
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextBlockHeight);
|
||||
bool isShielded = !fromTaddr || zaddrRecipients.size() > 0;
|
||||
if (contextualTx.nVersion == 1 && isShielded) {
|
||||
contextualTx.nVersion = 2; // Tx format should support vJoinSplits
|
||||
contextualTx.nVersion = 2; // Tx format should support vJoinSplits
|
||||
}
|
||||
|
||||
// Create operation and add to global queue
|
||||
|
@ -4628,7 +4630,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
|
|||
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(
|
||||
Params().GetConsensus(), nextBlockHeight);
|
||||
if (contextualTx.nVersion == 1) {
|
||||
contextualTx.nVersion = 2; // Tx format should support vJoinSplit
|
||||
contextualTx.nVersion = 2; // Tx format should support vJoinSplit
|
||||
}
|
||||
|
||||
// Create operation and add to global queue
|
||||
|
|
Loading…
Reference in New Issue