Skip to content

Commit 0f26562

Browse files
authored
feat: Add transaction propagation kind 'None' (paradigmxyz#17944)
1 parent a4c57de commit 0f26562

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/net/network/src/transactions/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@ pub enum TransactionPropagationKind {
125125
All,
126126
/// Propagate transactions to only trusted peers.
127127
Trusted,
128+
/// Do not propagate transactions
129+
None,
128130
}
129131

130132
impl TransactionPropagationPolicy for TransactionPropagationKind {
131133
fn can_propagate<N: NetworkPrimitives>(&self, peer: &mut PeerMetadata<N>) -> bool {
132134
match self {
133135
Self::All => true,
134136
Self::Trusted => peer.peer_kind.is_trusted(),
137+
Self::None => false,
135138
}
136139
}
137140

@@ -147,6 +150,7 @@ impl FromStr for TransactionPropagationKind {
147150
match s {
148151
"All" | "all" => Ok(Self::All),
149152
"Trusted" | "trusted" => Ok(Self::Trusted),
153+
"None" | "none" => Ok(Self::None),
150154
_ => Err(format!("Invalid transaction propagation policy: {s}")),
151155
}
152156
}

0 commit comments

Comments
 (0)