From 874e89e4f031f268c1dcad7e6e03a1e58052ed11 Mon Sep 17 00:00:00 2001 From: Duke Date: Thu, 25 Dec 2025 12:06:56 -0500 Subject: [PATCH] Only validate donation zaddrs if donating --- src/wallet/asyncrpcoperation_shieldcoinbase.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index a4e4cfecc..4c200d19a 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -216,17 +216,17 @@ bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) c m_op->builder_.AddTransparentInput(COutPoint(t.txid, t.vout), t.scriptPubKey, t.amount); } } - //TODO: TESTING zaddr only, only use on regtest - //TODO: randomly select from a set - auto dzaddr = "zregtestsapling1y30nwg0clsu6gcyrnvht8hdyfk3vwtszlh6kc4z5hv9hmpxzg2g0nx7c60xeecggm9x9gma96t4"; - auto donationZaddr = DecodePaymentAddress(dzaddr); - if (!IsValidPaymentAddress(donationZaddr)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid donation zaddr, Unknown address format: ") + dzaddr); - } - if(donation) { //if donation>0, send X% of value to zaddr and Y% of of value to donatezaddr where X+Y=100% + //TODO: TESTING zaddr only, only use on regtest + //TODO: randomly select from a set + auto dzaddr = "zregtestsapling1y30nwg0clsu6gcyrnvht8hdyfk3vwtszlh6kc4z5hv9hmpxzg2g0nx7c60xeecggm9x9gma96t4"; + auto donationZaddr = DecodePaymentAddress(dzaddr); + if (!IsValidPaymentAddress(donationZaddr)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid donation zaddr, Unknown address format: ") + dzaddr); + } + // calculate donation as a double then convert to CAmount double amount = (static_cast(donation)/100)*static_cast(sendAmount); CAmount donationAmount = static_cast(amount);