relay_server/services/processor/
transaction.rs

1//! Processing logic specific to transaction envelopes.
2
3use relay_dynamic_config::GlobalConfig;
4
5use crate::envelope::ItemType;
6use crate::services::outcome::{DiscardReason, Outcome};
7use crate::utils::{ItemAction, ManagedEnvelope};
8
9/// Drops attachments in transaction envelopes.
10pub fn drop_invalid_items(envelope: &mut ManagedEnvelope, global_config: &GlobalConfig) {
11    if global_config.options.drop_transaction_attachments {
12        envelope.retain_items(|item| match item.ty() {
13            &ItemType::Attachment => {
14                ItemAction::Drop(Outcome::Invalid(DiscardReason::TransactionAttachment))
15            }
16            _ => ItemAction::Keep,
17        });
18    }
19}