@@ -26,7 +26,7 @@ use crate::offers::invoice_request::InvoiceRequestFields;
26
26
use crate :: offers:: offer:: OfferId ;
27
27
use crate :: routing:: gossip:: { NodeId , ReadOnlyNetworkGraph } ;
28
28
use crate :: sign:: { EntropySource , NodeSigner , Recipient } ;
29
- use crate :: util:: ser:: { FixedLengthReader , LengthReadableArgs , HighZeroBytesDroppedBigSize , Readable , Writeable , Writer } ;
29
+ use crate :: util:: ser:: { FixedLengthReader , LengthReadableArgs , HighZeroBytesDroppedBigSize , Readable , WithoutLength , Writeable , Writer } ;
30
30
31
31
use core:: mem;
32
32
use core:: ops:: Deref ;
@@ -201,6 +201,9 @@ pub struct ForwardTlvs {
201
201
///
202
202
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
203
203
pub features : BlindedHopFeatures ,
204
+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the
205
+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
206
+ pub next_blinding_override : Option < PublicKey > ,
204
207
}
205
208
206
209
/// Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and
@@ -234,7 +237,7 @@ enum BlindedPaymentTlvsRef<'a> {
234
237
/// Parameters for relaying over a given [`BlindedHop`].
235
238
///
236
239
/// [`BlindedHop`]: crate::blinded_path::BlindedHop
237
- #[ derive( Clone , Debug ) ]
240
+ #[ derive( Clone , Debug , PartialEq ) ]
238
241
pub struct PaymentRelay {
239
242
/// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
240
243
pub cltv_expiry_delta : u16 ,
@@ -248,7 +251,7 @@ pub struct PaymentRelay {
248
251
/// Constraints for relaying over a given [`BlindedHop`].
249
252
///
250
253
/// [`BlindedHop`]: crate::blinded_path::BlindedHop
251
- #[ derive( Clone , Debug ) ]
254
+ #[ derive( Clone , Debug , PartialEq ) ]
252
255
pub struct PaymentConstraints {
253
256
/// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
254
257
pub max_cltv_expiry : u32 ,
@@ -341,7 +344,7 @@ impl Writeable for ForwardTlvs {
341
344
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
342
345
let features_opt =
343
346
if self . features == BlindedHopFeatures :: empty ( ) { None }
344
- else { Some ( & self . features ) } ;
347
+ else { Some ( WithoutLength ( & self . features ) ) } ;
345
348
encode_tlv_stream ! ( w, {
346
349
( 2 , self . short_channel_id, required) ,
347
350
( 10 , self . payment_relay, required) ,
@@ -379,9 +382,10 @@ impl Readable for BlindedPaymentTlvs {
379
382
_init_and_read_tlv_stream ! ( r, {
380
383
( 1 , _padding, option) ,
381
384
( 2 , scid, option) ,
385
+ ( 8 , next_blinding_override, option) ,
382
386
( 10 , payment_relay, option) ,
383
387
( 12 , payment_constraints, required) ,
384
- ( 14 , features, option) ,
388
+ ( 14 , features, ( option, encoding : ( BlindedHopFeatures , WithoutLength ) ) ) ,
385
389
( 65536 , payment_secret, option) ,
386
390
( 65537 , payment_context, ( default_value, PaymentContext :: unknown( ) ) ) ,
387
391
} ) ;
@@ -395,6 +399,7 @@ impl Readable for BlindedPaymentTlvs {
395
399
short_channel_id,
396
400
payment_relay : payment_relay. ok_or ( DecodeError :: InvalidValue ) ?,
397
401
payment_constraints : payment_constraints. 0 . unwrap ( ) ,
402
+ next_blinding_override,
398
403
features : features. unwrap_or_else ( BlindedHopFeatures :: empty) ,
399
404
} ) )
400
405
} else {
@@ -602,6 +607,7 @@ mod tests {
602
607
max_cltv_expiry: 0 ,
603
608
htlc_minimum_msat: 100 ,
604
609
} ,
610
+ next_blinding_override: None ,
605
611
features: BlindedHopFeatures :: empty( ) ,
606
612
} ,
607
613
htlc_maximum_msat: u64 :: max_value( ) ,
@@ -618,6 +624,7 @@ mod tests {
618
624
max_cltv_expiry: 0 ,
619
625
htlc_minimum_msat: 1_000 ,
620
626
} ,
627
+ next_blinding_override: None ,
621
628
features: BlindedHopFeatures :: empty( ) ,
622
629
} ,
623
630
htlc_maximum_msat: u64 :: max_value( ) ,
@@ -675,6 +682,7 @@ mod tests {
675
682
max_cltv_expiry: 0 ,
676
683
htlc_minimum_msat: 1 ,
677
684
} ,
685
+ next_blinding_override: None ,
678
686
features: BlindedHopFeatures :: empty( ) ,
679
687
} ,
680
688
htlc_maximum_msat: u64 :: max_value( )
@@ -691,6 +699,7 @@ mod tests {
691
699
max_cltv_expiry: 0 ,
692
700
htlc_minimum_msat: 2_000 ,
693
701
} ,
702
+ next_blinding_override: None ,
694
703
features: BlindedHopFeatures :: empty( ) ,
695
704
} ,
696
705
htlc_maximum_msat: u64 :: max_value( )
@@ -726,6 +735,7 @@ mod tests {
726
735
max_cltv_expiry: 0 ,
727
736
htlc_minimum_msat: 5_000 ,
728
737
} ,
738
+ next_blinding_override: None ,
729
739
features: BlindedHopFeatures :: empty( ) ,
730
740
} ,
731
741
htlc_maximum_msat: u64 :: max_value( )
@@ -742,6 +752,7 @@ mod tests {
742
752
max_cltv_expiry: 0 ,
743
753
htlc_minimum_msat: 2_000 ,
744
754
} ,
755
+ next_blinding_override: None ,
745
756
features: BlindedHopFeatures :: empty( ) ,
746
757
} ,
747
758
htlc_maximum_msat: u64 :: max_value( )
@@ -781,6 +792,7 @@ mod tests {
781
792
max_cltv_expiry: 0 ,
782
793
htlc_minimum_msat: 1 ,
783
794
} ,
795
+ next_blinding_override: None ,
784
796
features: BlindedHopFeatures :: empty( ) ,
785
797
} ,
786
798
htlc_maximum_msat: 5_000 ,
@@ -797,6 +809,7 @@ mod tests {
797
809
max_cltv_expiry: 0 ,
798
810
htlc_minimum_msat: 1 ,
799
811
} ,
812
+ next_blinding_override: None ,
800
813
features: BlindedHopFeatures :: empty( ) ,
801
814
} ,
802
815
htlc_maximum_msat: 10_000
0 commit comments