Closes #2045 by allowing z_sendmany with 0 fee

This commit is contained in:
Simon
2017-02-06 14:14:28 -08:00
parent 499e34fc64
commit 7eccce4e44
2 changed files with 7 additions and 2 deletions

View File

@@ -55,7 +55,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
Value contextInfo) : Value contextInfo) :
fromaddress_(fromAddress), t_outputs_(tOutputs), z_outputs_(zOutputs), mindepth_(minDepth), fee_(fee), contextinfo_(contextInfo) fromaddress_(fromAddress), t_outputs_(tOutputs), z_outputs_(zOutputs), mindepth_(minDepth), fee_(fee), contextinfo_(contextInfo)
{ {
assert(fee_ > 0); assert(fee_ >= 0);
if (minDepth < 0) { if (minDepth < 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minconf cannot be negative"); throw JSONRPCError(RPC_INVALID_PARAMETER, "Minconf cannot be negative");

View File

@@ -3383,7 +3383,12 @@ Value z_sendmany(const Array& params, bool fHelp)
// Fee in Zatoshis, not currency format) // Fee in Zatoshis, not currency format)
CAmount nFee = ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE; CAmount nFee = ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE;
if (params.size() > 3) { if (params.size() > 3) {
nFee = AmountFromValue( params[3] ); if (params[3].get_real() == 0.0) {
nFee = 0;
} else {
nFee = AmountFromValue( params[3] );
}
// Check that the user specified fee is sane. // Check that the user specified fee is sane.
if (nFee > nTotalOut) { if (nFee > nTotalOut) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Fee %s is greater than the sum of outputs %s", FormatMoney(nFee), FormatMoney(nTotalOut))); throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Fee %s is greater than the sum of outputs %s", FormatMoney(nFee), FormatMoney(nTotalOut)));