pub struct PartialHoprPacket {
partial_packet: PartialPacket<HoprSphinxSuite, HoprSphinxHeaderSpec>,
surbs: Vec<HoprSurb>,
openers: Vec<HoprReplyOpener>,
ticket: Ticket,
next_hop: OffchainPublicKey,
ack_challenge: HalfKeyChallenge,
}Expand description
Represents an outgoing packet that has been only partially instantiated.
It contains PartialPacket, required Proof-of-Relay
fields, and the [Ticket], but it does not contain the payload.
This can be used to pre-compute packets for certain destinations, and convert them to full packets once the payload is known.
Fields§
§partial_packet: PartialPacket<HoprSphinxSuite, HoprSphinxHeaderSpec>§surbs: Vec<HoprSurb>§openers: Vec<HoprReplyOpener>§ticket: Ticket§next_hop: OffchainPublicKey§ack_challenge: HalfKeyChallengeImplementations§
Source§impl PartialHoprPacket
impl PartialHoprPacket
Sourcepub fn new<M: ProtocolKeyIdMapper<HoprSphinxSuite, HoprSphinxHeaderSpec>, P: NonEmptyPath<OffchainPublicKey> + Send>(
pseudonym: &HoprPseudonym,
routing: PacketRouting<P>,
chain_keypair: &ChainKeypair,
ticket: TicketBuilder,
mapper: &M,
domain_separator: &Hash,
) -> Result<Self>
pub fn new<M: ProtocolKeyIdMapper<HoprSphinxSuite, HoprSphinxHeaderSpec>, P: NonEmptyPath<OffchainPublicKey> + Send>( pseudonym: &HoprPseudonym, routing: PacketRouting<P>, chain_keypair: &ChainKeypair, ticket: TicketBuilder, mapper: &M, domain_separator: &Hash, ) -> Result<Self>
Instantiates a new partial HOPR packet.
§Arguments
pseudonymour pseudonym as packet sender.routingrouting to the destination.chain_keypairprivate key of the local node.ticketticket builder for the first hop on the path.mapperof the public key identifiers.domain_separatorchannels contract domain separator.
Sourcepub fn into_hopr_packet<S: Into<PacketSignals>>(
self,
msg: &[u8],
signals: S,
) -> Result<(HoprPacket, Vec<HoprReplyOpener>)>
pub fn into_hopr_packet<S: Into<PacketSignals>>( self, msg: &[u8], signals: S, ) -> Result<(HoprPacket, Vec<HoprReplyOpener>)>
Turns this partial HOPR packet into a full Outgoing HoprPacket by
attaching the given payload msg and optional packet signals for the recipient.
No signals are equivalent to 0.
Trait Implementations§
Source§impl Clone for PartialHoprPacket
impl Clone for PartialHoprPacket
Source§fn clone(&self) -> PartialHoprPacket
fn clone(&self) -> PartialHoprPacket
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de> Deserialize<'de> for PartialHoprPacket
impl<'de> Deserialize<'de> for PartialHoprPacket
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PartialHoprPacket
impl RefUnwindSafe for PartialHoprPacket
impl Send for PartialHoprPacket
impl Sync for PartialHoprPacket
impl Unpin for PartialHoprPacket
impl UnwindSafe for PartialHoprPacket
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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