pub struct HoprDecoder<Chain, S, T> {
chain_api: Chain,
surb_store: Arc<S>,
tracker: T,
packet_key: OffchainKeypair,
chain_key: ChainKeypair,
channels_dst: Hash,
cfg: HoprCodecConfig,
tbf: Mutex<TagBloomFilter>,
peer_id_cache: Cache<PeerId, OffchainPublicKey>,
}Expand description
Default decoder implementation for HOPR packets.
Fields§
§chain_api: Chain§surb_store: Arc<S>§tracker: T§packet_key: OffchainKeypair§chain_key: ChainKeypair§channels_dst: Hash§cfg: HoprCodecConfig§tbf: Mutex<TagBloomFilter>§peer_id_cache: Cache<PeerId, OffchainPublicKey>Implementations§
Source§impl<Chain, S, T> HoprDecoder<Chain, S, T>
impl<Chain, S, T> HoprDecoder<Chain, S, T>
Sourcepub fn new(
(packet_key, chain_key): (OffchainKeypair, ChainKeypair),
chain_api: Chain,
surb_store: S,
tracker: T,
channels_dst: Hash,
cfg: HoprCodecConfig,
) -> Self
pub fn new( (packet_key, chain_key): (OffchainKeypair, ChainKeypair), chain_api: Chain, surb_store: S, tracker: T, channels_dst: Hash, cfg: HoprCodecConfig, ) -> Self
Creates a new instance of the decoder.
async fn validate_and_replace_ticket( &self, fwd: HoprForwardedPacket, ) -> Result<(HoprForwardedPacket, UnacknowledgedTicket), HoprProtocolError>
Trait Implementations§
Source§impl<Chain, S, T> PacketDecoder for HoprDecoder<Chain, S, T>
impl<Chain, S, T> PacketDecoder for HoprDecoder<Chain, S, T>
type Error = HoprProtocolError
Source§fn decode<'life0, 'async_trait>(
&'life0 self,
sender: PeerId,
data: Box<[u8]>,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn decode<'life0, 'async_trait>(
&'life0 self,
sender: PeerId,
data: Box<[u8]>,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Decodes the
data received from the given sender
returns the corresponding IncomingPacket if the decoding into a HOPR packet was successful.Auto Trait Implementations§
impl<Chain, S, T> !Freeze for HoprDecoder<Chain, S, T>
impl<Chain, S, T> !RefUnwindSafe for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Send for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Sync for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Unpin for HoprDecoder<Chain, S, T>
impl<Chain, S, T> !UnwindSafe for HoprDecoder<Chain, S, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more