Update and fix per review comments, the test for absurd fee.

This commit is contained in:
Simon 2018-07-17 13:00:42 -07:00
parent 4b8c52c65c
commit 0b6eeac330
2 changed files with 5 additions and 5 deletions

View File

@ -488,9 +488,9 @@ class WalletTest (BitcoinTestFramework):
myopid = self.nodes[0].z_sendmany(myzaddr, recipients, minconf, fee)
except JSONRPCException,e:
errorString = e.error['message']
assert('Small transaction amount' in errorString)
assert('Small transaction amount' in errorString)
#### This fee is less than default and greater than amount, but still valid
# This fee is less than default and greater than amount, but still valid
fee = Decimal('0.0000001')
recipients = [ {"address": myzaddr, "amount": Decimal('0.00000001') } ]
minconf = 1
@ -504,7 +504,7 @@ class WalletTest (BitcoinTestFramework):
print errorString
assert(False)
### Make sure amount=0, fee=0 transaction are valid to add to mempool
# Make sure amount=0, fee=0 transaction are valid to add to mempool
# though miners decide whether to add to a block
fee = Decimal('0.0')
minconf = 1

View File

@ -3708,7 +3708,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
nFee = AmountFromValue( params[3] );
}
// Check that the user specified fee is sane.
// Check that the user specified fee is not absurd.
// This allows amount=0 (and all amount < nDefaultFee) transactions to use the default network fee
// or anything less than nDefaultFee instead of being forced to use a custom fee and leak metadata
if (nTotalOut < nDefaultFee) {
@ -3716,7 +3716,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Small transaction amount %s has fee %s that is greater than the default fee %s", FormatMoney(nTotalOut), FormatMoney(nFee), FormatMoney(nDefaultFee)));
}
} else {
// Check that the user specified fee is sane.
// Check that the user specified fee is not absurd.
if (nFee > nTotalOut) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Fee %s is greater than the sum of outputs %s and also greater than the default fee", FormatMoney(nFee), FormatMoney(nTotalOut)));
}