@@ -321,6 +321,8 @@ pub struct InnerTransaction {
321321 pub data : Option < String > ,
322322 pub extra_sections : HashMap < Id , Vec < u8 > > ,
323323 pub notes : u64 ,
324+ // FIXME: should this be on the wrapper?
325+ pub is_masp_fee_payment : bool ,
324326 pub exit_code : TransactionExitStatus ,
325327}
326328
@@ -330,10 +332,12 @@ impl InnerTransaction {
330332 }
331333
332334 /// An inner transaction is successful only if both the inner tx itself and
333- /// the containing wrapper are marked as applied
335+ /// the containing wrapper are marked as applied or, in case of a failing
336+ /// atomic batch, if the inner tx was applied and did masp fee payment
334337 pub fn was_successful ( & self , wrapper_tx : & WrapperTransaction ) -> bool {
335- wrapper_tx. exit_code == TransactionExitStatus :: Applied
336- && self . exit_code == TransactionExitStatus :: Applied
338+ self . exit_code == TransactionExitStatus :: Applied
339+ && ( wrapper_tx. exit_code == TransactionExitStatus :: Applied
340+ || self . is_masp_fee_payment )
337341 }
338342
339343 pub fn is_ibc ( & self ) -> bool {
@@ -503,20 +507,8 @@ impl Transaction {
503507 } ;
504508 let masp_ref_opt = block_results. masp_ref ( & indexed_tx) ;
505509
506- // FIXME: here and in other places take into account masp
507- // fee payment for failed atomic batches
508- // FIXME: probably better to rework the was_successful
509- // function and call that one here
510- // MASP events are emitted only for successful inner txs
511- let masp_bundle = matches ! (
512- ( & wrapper_tx_status, & inner_tx_status) ,
513- (
514- & TransactionExitStatus :: Applied ,
515- & TransactionExitStatus :: Applied
516- )
517- )
518- . then ( || {
519- masp_ref_opt. map ( |masp_ref| {
510+ let masp_bundle =
511+ masp_ref_opt. map ( |( masp_ref, is_masp_fee_payment) | {
520512 // Cast the ref to the appropriate type
521513 let masp_tx_ref = match masp_ref {
522514 crate :: block_result:: MaspRef :: MaspSection (
@@ -527,18 +519,29 @@ impl Transaction {
527519 }
528520 } ;
529521
530- extract_masp_transaction ( & transaction, & masp_tx_ref)
531- } )
532- } )
533- . flatten ( ) ;
534-
535- let notes = masp_bundle. map_or ( 0 , |bundle| {
536- bundle. sapling_bundle ( ) . map_or ( 0 , |bundle| {
537- bundle. shielded_spends . len ( )
538- + bundle. shielded_outputs . len ( )
539- + bundle. shielded_converts . len ( )
540- } )
541- } ) as u64 ;
522+ (
523+ extract_masp_transaction (
524+ & transaction,
525+ & masp_tx_ref,
526+ ) ,
527+ is_masp_fee_payment,
528+ )
529+ } ) ;
530+
531+ let ( notes, is_masp_fee_payment) = masp_bundle. map_or (
532+ ( 0 , false ) ,
533+ |( bundle, is_masp_fee_payment) | {
534+ (
535+ bundle. sapling_bundle ( ) . map_or ( 0 , |bundle| {
536+ ( bundle. shielded_spends . len ( )
537+ + bundle. shielded_outputs . len ( )
538+ + bundle. shielded_converts . len ( ) )
539+ as u64
540+ } ) ,
541+ is_masp_fee_payment,
542+ )
543+ } ,
544+ ) ;
542545
543546 let inner_tx = InnerTransaction {
544547 tx_id : inner_tx_id,
@@ -550,6 +553,7 @@ impl Transaction {
550553 notes,
551554 exit_code : inner_tx_status,
552555 kind : tx_kind,
556+ is_masp_fee_payment,
553557 } ;
554558
555559 inner_txs. push ( inner_tx) ;
0 commit comments