@@ -199,6 +199,7 @@ pub(crate) enum HTLCSource {
199
199
/// doing a double-pass on route when we get a failure back
200
200
first_hop_htlc_msat : u64 ,
201
201
payment_id : PaymentId ,
202
+ payment_secret : Option < PaymentSecret > ,
202
203
} ,
203
204
}
204
205
#[ cfg( test) ]
@@ -209,6 +210,7 @@ impl HTLCSource {
209
210
session_priv : SecretKey :: from_slice ( & [ 1 ; 32 ] ) . unwrap ( ) ,
210
211
first_hop_htlc_msat : 0 ,
211
212
payment_id : PaymentId ( [ 2 ; 32 ] ) ,
213
+ payment_secret : None ,
212
214
}
213
215
}
214
216
}
@@ -2026,6 +2028,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2026
2028
session_priv: session_priv. clone( ) ,
2027
2029
first_hop_htlc_msat: htlc_msat,
2028
2030
payment_id,
2031
+ payment_secret: payment_secret. clone( ) ,
2029
2032
} , onion_packet, & self . logger) ,
2030
2033
channel_state, chan) ;
2031
2034
@@ -5326,10 +5329,12 @@ impl Readable for HTLCSource {
5326
5329
let mut first_hop_htlc_msat: u64 = 0 ;
5327
5330
let mut path = Some ( Vec :: new ( ) ) ;
5328
5331
let mut payment_id = None ;
5332
+ let mut payment_secret = None ;
5329
5333
read_tlv_fields ! ( reader, {
5330
5334
( 0 , session_priv, required) ,
5331
5335
( 1 , payment_id, option) ,
5332
5336
( 2 , first_hop_htlc_msat, required) ,
5337
+ ( 3 , payment_secret, option) ,
5333
5338
( 4 , path, vec_type) ,
5334
5339
} ) ;
5335
5340
if payment_id. is_none ( ) {
@@ -5342,6 +5347,7 @@ impl Readable for HTLCSource {
5342
5347
first_hop_htlc_msat : first_hop_htlc_msat,
5343
5348
path : path. unwrap ( ) ,
5344
5349
payment_id : payment_id. unwrap ( ) ,
5350
+ payment_secret,
5345
5351
} )
5346
5352
}
5347
5353
1 => Ok ( HTLCSource :: PreviousHopData ( Readable :: read ( reader) ?) ) ,
@@ -5353,13 +5359,14 @@ impl Readable for HTLCSource {
5353
5359
impl Writeable for HTLCSource {
5354
5360
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: io:: Error > {
5355
5361
match self {
5356
- HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id } => {
5362
+ HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id, payment_secret } => {
5357
5363
0u8 . write ( writer) ?;
5358
5364
let payment_id_opt = Some ( payment_id) ;
5359
5365
write_tlv_fields ! ( writer, {
5360
5366
( 0 , session_priv, required) ,
5361
5367
( 1 , payment_id_opt, option) ,
5362
5368
( 2 , first_hop_htlc_msat, required) ,
5369
+ ( 3 , payment_secret, option) ,
5363
5370
( 4 , path, vec_type) ,
5364
5371
} ) ;
5365
5372
}
0 commit comments