File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1402,6 +1402,10 @@ RPCHelpMan sendall()
14021402 const CAmount fee_from_size{fee_rate.GetFee (tx_size.vsize )};
14031403 const CAmount effective_value{total_input_value - fee_from_size};
14041404
1405+ if (fee_from_size > pwallet->m_default_max_tx_fee ) {
1406+ throw JSONRPCError (RPC_WALLET_ERROR, TransactionErrorString (TransactionError::MAX_FEE_EXCEEDED).original );
1407+ }
1408+
14051409 if (effective_value <= 0 ) {
14061410 if (send_max) {
14071411 throw JSONRPCError (RPC_WALLET_INSUFFICIENT_FUNDS, " Total value of UTXO pool too low to pay for transaction, try using lower feerate." );
Original file line number Diff line number Diff line change @@ -264,6 +264,18 @@ def sendall_fails_on_specific_inputs_with_send_max(self):
264264 recipients = [self .remainder_target ],
265265 options = {"inputs" : [utxo ], "send_max" : True })
266266
267+ @cleanup
268+ def sendall_fails_on_high_fee (self ):
269+ self .log .info ("Test sendall fails if the transaction fee exceeds the maxtxfee" )
270+ self .add_utxos ([21 ])
271+
272+ assert_raises_rpc_error (
273+ - 4 ,
274+ "Fee exceeds maximum configured by user" ,
275+ self .wallet .sendall ,
276+ recipients = [self .remainder_target ],
277+ fee_rate = 100000 )
278+
267279 def run_test (self ):
268280 self .nodes [0 ].createwallet ("activewallet" )
269281 self .wallet = self .nodes [0 ].get_wallet_rpc ("activewallet" )
@@ -312,5 +324,8 @@ def run_test(self):
312324 # Sendall fails when using send_max while specifying inputs
313325 self .sendall_fails_on_specific_inputs_with_send_max ()
314326
327+ # Sendall fails when providing a fee that is too high
328+ self .sendall_fails_on_high_fee ()
329+
315330if __name__ == '__main__' :
316331 SendallTest ().main ()
You can’t perform that action at this time.
0 commit comments