@@ -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
}
@@ -2024,6 +2026,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2024
2026
session_priv: session_priv. clone( ) ,
2025
2027
first_hop_htlc_msat: htlc_msat,
2026
2028
payment_id,
2029
+ payment_secret: payment_secret. clone( ) ,
2027
2030
} , onion_packet, & self . logger) ,
2028
2031
channel_state, chan) ;
2029
2032
@@ -5322,10 +5325,12 @@ impl Readable for HTLCSource {
5322
5325
let mut first_hop_htlc_msat: u64 = 0 ;
5323
5326
let mut path = Some ( Vec :: new ( ) ) ;
5324
5327
let mut payment_id = None ;
5328
+ let mut payment_secret = None ;
5325
5329
read_tlv_fields ! ( reader, {
5326
5330
( 0 , session_priv, required) ,
5327
5331
( 1 , payment_id, option) ,
5328
5332
( 2 , first_hop_htlc_msat, required) ,
5333
+ ( 3 , payment_secret, option) ,
5329
5334
( 4 , path, vec_type) ,
5330
5335
} ) ;
5331
5336
if payment_id. is_none ( ) {
@@ -5338,6 +5343,7 @@ impl Readable for HTLCSource {
5338
5343
first_hop_htlc_msat : first_hop_htlc_msat,
5339
5344
path : path. unwrap ( ) ,
5340
5345
payment_id : payment_id. unwrap ( ) ,
5346
+ payment_secret,
5341
5347
} )
5342
5348
}
5343
5349
1 => Ok ( HTLCSource :: PreviousHopData ( Readable :: read ( reader) ?) ) ,
@@ -5349,13 +5355,14 @@ impl Readable for HTLCSource {
5349
5355
impl Writeable for HTLCSource {
5350
5356
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: io:: Error > {
5351
5357
match self {
5352
- HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id } => {
5358
+ HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id, payment_secret } => {
5353
5359
0u8 . write ( writer) ?;
5354
5360
let payment_id_opt = Some ( payment_id) ;
5355
5361
write_tlv_fields ! ( writer, {
5356
5362
( 0 , session_priv, required) ,
5357
5363
( 1 , payment_id_opt, option) ,
5358
5364
( 2 , first_hop_htlc_msat, required) ,
5365
+ ( 3 , payment_secret, option) ,
5359
5366
( 4 , path, vec_type) ,
5360
5367
} ) ;
5361
5368
}
0 commit comments