@@ -870,11 +870,43 @@ func (p *ChainPorter) transferReceiverProof(pkg *sendPackage) error {
870870
871871 // If we have a non-interactive proof, then we'll launch several
872872 // goroutines to deliver the proof(s) to the receiver(s).
873- err := fn .ParSlice (ctx , pkg .OutboundPkg .Outputs , deliver )
873+ instanceErrors , err := fn .ParSliceErrCollect (
874+ ctx , pkg .OutboundPkg .Outputs , deliver ,
875+ )
874876 if err != nil {
875877 return fmt .Errorf ("error delivering proof(s): %w" , err )
876878 }
877879
880+ // If there were any errors during the proof delivery process, we'll
881+ // log them all here.
882+ for idx := range instanceErrors {
883+ output := pkg .OutboundPkg .Outputs [idx ]
884+ instanceErr := instanceErrors [idx ]
885+
886+ scriptPubKey := output .ScriptKey .PubKey .SerializeCompressed ()
887+ anchorOutpoint := output .Anchor .OutPoint .String ()
888+ courierAddr := string (output .ProofCourierAddr )
889+
890+ log .Errorf ("Error delivering transfer output proof " +
891+ "(anchor_outpoint=%s, script_pub_key=%v, " +
892+ "position=%d, proof_courier_addr=%s, " +
893+ "proof_delivery_status=%v): %v" ,
894+ anchorOutpoint , scriptPubKey , output .Position ,
895+ courierAddr , output .ProofDeliveryComplete ,
896+ instanceErr )
897+ }
898+
899+ // Return the first error encountered during the proof delivery process,
900+ // if any.
901+ var firstErr error
902+ fn .PeekMap (instanceErrors ).WhenSome (func (kv fn.KV [int , error ]) {
903+ firstErr = err
904+ })
905+
906+ if firstErr != nil {
907+ return firstErr
908+ }
909+
878910 // At this point, the transfer is fully finalised and successful:
879911 // - The anchoring transaction has been confirmed on-chain.
880912 // - The proof(s) have been delivered to the receiver(s).
0 commit comments