Add test for Orchard contribution to z_gettotalbalance

This commit is contained in:
Kris Nuttycombe 2022-03-03 17:39:26 -07:00
parent 1732a50957
commit cf4d0f3d2d
2 changed files with 9 additions and 2 deletions

View File

@ -176,6 +176,10 @@ class WalletAccountsTest(BitcoinTestFramework):
self.check_balance(0, 0, ua0, {'sapling': 9})
self.check_balance(0, 0, ua0, {'sapling': 9, 'orchard': 10}, 0)
# The total balance with the default minconf should be just the Sapling balance
assert_equal('9.00', self.nodes[0].z_gettotalbalance()['private'])
assert_equal('19.00', self.nodes[0].z_gettotalbalance(0)['private'])
self.nodes[2].generate(1)
self.sync_all()

View File

@ -3410,6 +3410,9 @@ CAmount getBalanceZaddr(std::optional<libzcash::PaymentAddress> address, int min
for (auto & entry : saplingEntries) {
balance += CAmount(entry.note.value());
}
for (auto & entry : orchardEntries) {
balance += entry.GetNoteValue();
}
return balance;
}
@ -4407,7 +4410,7 @@ size_t EstimateTxSize(
[&](const libzcash::OrchardRawAddress& addr) {
if (fromSprout) {
throw JSONRPCError(
RPC_INVALID_PARAMETER,
RPC_INVALID_PARAMETER,
"Sending funds from a Sprout address to a Unified Address is not supported by z_sendmany");
}
orchardRecipientCount += 1;
@ -4419,7 +4422,7 @@ size_t EstimateTxSize(
if (fromSprout || !nu5Active) {
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
mtx.nVersion = SAPLING_TX_VERSION;
} else {
mtx.nVersionGroupId = ZIP225_VERSION_GROUP_ID;
mtx.nVersion = ZIP225_TX_VERSION;