Hello SID,
Yes, policy that you have written is correct for transit traffic.
In Junos default policy is to deny all traffic, I believe you have another policy to allow all other traffic like below:
---------------
set security policies from-zone A to-zone B policy Y-BFLY-OUT match source-address A
set security policies from-zone A to-zone B policy Y-BFLY-OUT match destination-address any
set security policies from-zone A to-zone B policy Y-BFLY-OUT match application junos-icmp-all
set security policies from-zone A to-zone B policy Y-BFLY-OUT then deny
set security policies from-zone A to-zone B policy Y-BFLY-OUT-1 match source-address A
set security policies from-zone A to-zone B policy Y-BFLY-OUT-1 match destination-address any
set security policies from-zone A to-zone B policy Y-BFLY-OUT-1 match application any
set security policies from-zone A to-zone B policy Y-BFLY-OUT-1 then permit
----------------
Regards,
Raveen