@@ -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
assert ! ( payment. insert( session_priv_bytes, path. last( ) . unwrap( ) . fee_msat) ) ;
@@ -5314,10 +5317,12 @@ impl Readable for HTLCSource {
5314
5317
let mut first_hop_htlc_msat: u64 = 0 ;
5315
5318
let mut path = Some ( Vec :: new ( ) ) ;
5316
5319
let mut payment_id = None ;
5320
+ let mut payment_secret = None ;
5317
5321
read_tlv_fields ! ( reader, {
5318
5322
( 0 , session_priv, required) ,
5319
5323
( 1 , payment_id, option) ,
5320
5324
( 2 , first_hop_htlc_msat, required) ,
5325
+ ( 3 , payment_secret, option) ,
5321
5326
( 4 , path, vec_type) ,
5322
5327
} ) ;
5323
5328
if payment_id. is_none ( ) {
@@ -5330,6 +5335,7 @@ impl Readable for HTLCSource {
5330
5335
first_hop_htlc_msat : first_hop_htlc_msat,
5331
5336
path : path. unwrap ( ) ,
5332
5337
payment_id : payment_id. unwrap ( ) ,
5338
+ payment_secret,
5333
5339
} )
5334
5340
}
5335
5341
1 => Ok ( HTLCSource :: PreviousHopData ( Readable :: read ( reader) ?) ) ,
@@ -5341,13 +5347,14 @@ impl Readable for HTLCSource {
5341
5347
impl Writeable for HTLCSource {
5342
5348
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: io:: Error > {
5343
5349
match self {
5344
- HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id } => {
5350
+ HTLCSource :: OutboundRoute { ref session_priv, ref first_hop_htlc_msat, ref path, payment_id, payment_secret } => {
5345
5351
0u8 . write ( writer) ?;
5346
5352
let payment_id_opt = Some ( payment_id) ;
5347
5353
write_tlv_fields ! ( writer, {
5348
5354
( 0 , session_priv, required) ,
5349
5355
( 1 , payment_id_opt, option) ,
5350
5356
( 2 , first_hop_htlc_msat, required) ,
5357
+ ( 3 , payment_secret, option) ,
5351
5358
( 4 , path, vec_type) ,
5352
5359
} ) ;
5353
5360
}
0 commit comments