@@ -480,14 +480,36 @@ pub fn display_batch_resp(context: &impl Namada, resp: &TxResponse) {
480
480
false
481
481
} ;
482
482
let batch_results = resp. batch_result ( ) ;
483
- if !batch_results. is_empty ( ) {
483
+ // If the batch contains at least one transaction
484
+ if let Some ( ( first_inner_hash, first_result) ) = batch_results. first ( ) {
484
485
if !wrapper_successful {
485
- display_line ! (
486
- context. io( ) ,
487
- "Since the batch in its entirety failed, none of the \
488
- transactions listed below have been committed. Their results \
489
- are provided for completeness.",
486
+ // Check if fees were paid via the shielded pool, in this case the
487
+ // first transaction of the batch was committed regardless of the
488
+ // batch failure (even for atomic batches)
489
+ let masp_fee_payment = matches ! (
490
+ first_result,
491
+ InnerTxResult :: Success ( res)
492
+ if res. events. iter( ) . any( |event| {
493
+ event. kind( ) == & namada_tx:: event:: masp_types:: FEE_PAYMENT
494
+ } )
490
495
) ;
496
+ if masp_fee_payment {
497
+ display_line ! (
498
+ context. io( ) ,
499
+ "The first transaction of the batch ({}) was applied to \
500
+ pay the fees via the MASP. Since the batch failed, none \
501
+ of the remaining transactions listed below have been \
502
+ committed. Their results are provided for completeness.",
503
+ first_inner_hash
504
+ ) ;
505
+ } else {
506
+ display_line ! (
507
+ context. io( ) ,
508
+ "Since the batch in its entirety failed, none of the \
509
+ transactions listed below have been committed. Their \
510
+ results are provided for completeness.",
511
+ ) ;
512
+ }
491
513
}
492
514
display_line ! ( context. io( ) , "Batch results:" ) ;
493
515
}
0 commit comments