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()
1402
1402
const CAmount fee_from_size{fee_rate.GetFee (tx_size.vsize )};
1403
1403
const CAmount effective_value{total_input_value - fee_from_size};
1404
1404
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
+
1405
1409
if (effective_value <= 0 ) {
1406
1410
if (send_max) {
1407
1411
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):
264
264
recipients = [self .remainder_target ],
265
265
options = {"inputs" : [utxo ], "send_max" : True })
266
266
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
+
267
279
def run_test (self ):
268
280
self .nodes [0 ].createwallet ("activewallet" )
269
281
self .wallet = self .nodes [0 ].get_wallet_rpc ("activewallet" )
@@ -312,5 +324,8 @@ def run_test(self):
312
324
# Sendall fails when using send_max while specifying inputs
313
325
self .sendall_fails_on_specific_inputs_with_send_max ()
314
326
327
+ # Sendall fails when providing a fee that is too high
328
+ self .sendall_fails_on_high_fee ()
329
+
315
330
if __name__ == '__main__' :
316
331
SendallTest ().main ()
You can’t perform that action at this time.
0 commit comments