Only validate donation zaddrs if donating
This commit is contained in:
@@ -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<double>(donation)/100)*static_cast<double>(sendAmount);
|
||||
CAmount donationAmount = static_cast<CAmount>(amount);
|
||||
|
||||
Reference in New Issue
Block a user