pub struct TlcErrPacket {
pub onion_packet: Vec<u8>,
}Expand description
An encrypted error packet for TLC failures. The sender should decode it and then decide what to do with the error. Note: this is supposed to be only accessible by the sender, and it’s not reliable since it is not placed on-chain due to the possibility of hop failure.
Fields§
§onion_packet: Vec<u8>Implementations§
Source§impl TlcErrPacket
impl TlcErrPacket
Sourcepub fn from_payload(payload: Vec<u8>, shared_secret: &[u8; 32]) -> Self
pub fn from_payload(payload: Vec<u8>, shared_secret: &[u8; 32]) -> Self
Create a new TlcErrPacket from raw payload bytes. Erring node creates the error packet using the shared secret used in forwarding onion packet.
Sourcepub fn is_plaintext(&self) -> bool
pub fn is_plaintext(&self) -> bool
Check if this packet is plaintext (not encrypted).
Source§impl TlcErrPacket
impl TlcErrPacket
Sourcepub fn new(tlc_fail: TlcErr, shared_secret: &[u8; 32]) -> Self
pub fn new(tlc_fail: TlcErr, shared_secret: &[u8; 32]) -> Self
Erring node creates the error packet using the shared secret used in forwarding onion packet.
Takes a structured TlcErr and serializes it.
Sourcepub fn decode(
&self,
session_key: &[u8; 32],
hops_public_keys: Vec<Pubkey>,
) -> Option<DecodedTlcErr>
pub fn decode( &self, session_key: &[u8; 32], hops_public_keys: Vec<Pubkey>, ) -> Option<DecodedTlcErr>
Decode the onion error packet using the session key and hop public keys.
Sourcepub fn new_trampoline_failed(
error_code: TlcErrorCode,
node_id: Pubkey,
inner_error_packet: Vec<u8>,
shared_secret: &[u8; 32],
) -> Self
pub fn new_trampoline_failed( error_code: TlcErrorCode, node_id: Pubkey, inner_error_packet: Vec<u8>, shared_secret: &[u8; 32], ) -> Self
Create a trampoline failure wrapper encrypted with the upstream outer shared secret.
Returning None means the caller would have produced a plaintext trampoline wrapper.
Trait Implementations§
Source§impl Clone for TlcErrPacket
impl Clone for TlcErrPacket
Source§fn clone(&self) -> TlcErrPacket
fn clone(&self) -> TlcErrPacket
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more