@@ -1740,6 +1740,17 @@ mod fuzzy_internal_msgs {
1740
1740
}
1741
1741
}
1742
1742
1743
+ pub ( crate ) enum OutboundTrampolinePayload {
1744
+ #[ allow( unused) ]
1745
+ Forward {
1746
+ /// The value, in msat, of the payment after this hop's fee is deducted.
1747
+ amt_to_forward : u64 ,
1748
+ outgoing_cltv_value : u32 ,
1749
+ /// The node id to which the trampoline node must find a route
1750
+ outgoing_node_id : PublicKey ,
1751
+ }
1752
+ }
1753
+
1743
1754
pub struct DecodedOnionErrorPacket {
1744
1755
pub ( crate ) hmac : [ u8 ; 32 ] ,
1745
1756
pub ( crate ) failuremsg : Vec < u8 > ,
@@ -1798,7 +1809,7 @@ pub struct TrampolineOnionPacket {
1798
1809
// Unlike the onion packets used for payments, Trampoline onion packets have to be shorter than
1799
1810
// 1300 bytes. The expected default is 650 bytes.
1800
1811
// TODO: if 650 ends up being the most common size, optimize this to be:
1801
- // enum { ThirteenHundred ([u8; 650]), VarLen(Vec<u8>) }
1812
+ // enum { SixFifty ([u8; 650]), VarLen(Vec<u8>) }
1802
1813
pub hop_data : Vec < u8 > ,
1803
1814
/// HMAC to verify the integrity of hop_data
1804
1815
pub hmac : [ u8 ; 32 ] ,
@@ -2597,6 +2608,22 @@ impl Writeable for OutboundOnionPayload {
2597
2608
}
2598
2609
}
2599
2610
2611
+ impl Writeable for OutboundTrampolinePayload {
2612
+ fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
2613
+ match self {
2614
+ Self :: Forward { amt_to_forward, outgoing_cltv_value, outgoing_node_id } => {
2615
+ _encode_varint_length_prefixed_tlv ! ( w, {
2616
+ ( 2 , HighZeroBytesDroppedBigSize ( * amt_to_forward) , required) ,
2617
+ ( 4 , HighZeroBytesDroppedBigSize ( * outgoing_cltv_value) , required) ,
2618
+ ( 14 , outgoing_node_id, required)
2619
+ } ) ;
2620
+ }
2621
+ }
2622
+ Ok ( ( ) )
2623
+ }
2624
+ }
2625
+
2626
+
2600
2627
impl < NS : Deref > ReadableArgs < ( Option < PublicKey > , & NS ) > for InboundOnionPayload where NS :: Target : NodeSigner {
2601
2628
fn read < R : Read > ( r : & mut R , args : ( Option < PublicKey > , & NS ) ) -> Result < Self , DecodeError > {
2602
2629
let ( update_add_blinding_point, node_signer) = args;
0 commit comments