reth::network

Trait ValidateTx68

pub trait ValidateTx68 {
    // Required methods
    fn should_fetch(
        &self,
        ty: u8,
        hash: &FixedBytes<32>,
        size: usize,
        tx_types_counter: &mut TxTypesCounter,
    ) -> ValidationOutcome;
    fn max_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
    fn strict_max_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
    fn min_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
    fn strict_min_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
}
Expand description

Interface for validating a (ty, size, hash) tuple from a NewPooledTransactionHashes68..

Required Methods§

fn should_fetch( &self, ty: u8, hash: &FixedBytes<32>, size: usize, tx_types_counter: &mut TxTypesCounter, ) -> ValidationOutcome

Validates a NewPooledTransactionHashes68 entry. Returns ValidationOutcome which signals to the caller whether to fetch the transaction or to drop it, and whether the sender of the announcement should be penalized.

fn max_encoded_tx_length(&self, ty: TxType) -> Option<usize>

Returns the reasonable maximum encoded transaction length configured for this network, if any. This property is not spec’ed out but can be inferred by looking how much data can be packed into a transaction for any given transaction type.

fn strict_max_encoded_tx_length(&self, ty: TxType) -> Option<usize>

Returns the strict maximum encoded transaction length for the given transaction type, if any.

fn min_encoded_tx_length(&self, ty: TxType) -> Option<usize>

Returns the reasonable minimum encoded transaction length, if any. This property is not spec’ed out but can be inferred by looking at which reth_primitives::PooledTransaction will successfully pass decoding for any given transaction type.

fn strict_min_encoded_tx_length(&self, ty: TxType) -> Option<usize>

Returns the strict minimum encoded transaction length for the given transaction type, if any.

Implementors§