@@ -30,7 +30,7 @@ use crate::routing::gossip::NetworkUpdate;
30
30
use crate :: util:: errors:: APIError ;
31
31
use crate :: util:: ser:: { BigSize , FixedLengthReader , Writeable , Writer , MaybeReadable , Readable , RequiredWrapper , UpgradableRequired , WithoutLength } ;
32
32
use crate :: util:: string:: UntrustedString ;
33
- use crate :: routing:: router:: { RouteHop , RouteParameters } ;
33
+ use crate :: routing:: router:: { BlindedTail , Path , RouteHop , RouteParameters } ;
34
34
35
35
use bitcoin:: { PackedLockTime , Transaction , OutPoint } ;
36
36
#[ cfg( anchors) ]
@@ -447,7 +447,7 @@ pub enum Event {
447
447
/// The payment path that was successful.
448
448
///
449
449
/// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
450
- path : Vec < RouteHop > ,
450
+ path : Path ,
451
451
} ,
452
452
/// Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
453
453
/// handle the HTLC.
@@ -480,7 +480,7 @@ pub enum Event {
480
480
/// [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
481
481
failure : PathFailure ,
482
482
/// The payment path that failed.
483
- path : Vec < RouteHop > ,
483
+ path : Path ,
484
484
/// The channel responsible for the failed payment path.
485
485
///
486
486
/// Note that for route hints or for the first hop in a path this may be an SCID alias and
@@ -506,7 +506,7 @@ pub enum Event {
506
506
/// [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
507
507
payment_hash : PaymentHash ,
508
508
/// The payment path that was successful.
509
- path : Vec < RouteHop > ,
509
+ path : Path ,
510
510
} ,
511
511
/// Indicates that a probe payment we sent failed at an intermediary node on the path.
512
512
ProbeFailed {
@@ -519,7 +519,7 @@ pub enum Event {
519
519
/// [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
520
520
payment_hash : PaymentHash ,
521
521
/// The payment path that failed.
522
- path : Vec < RouteHop > ,
522
+ path : Path ,
523
523
/// The channel responsible for the failed probe.
524
524
///
525
525
/// Note that for route hints or for the first hop in a path this may be an SCID alias and
@@ -824,7 +824,8 @@ impl Writeable for Event {
824
824
( 1 , None :: <NetworkUpdate >, option) , // network_update in LDK versions prior to 0.0.114
825
825
( 2 , payment_failed_permanently, required) ,
826
826
( 3 , false , required) , // all_paths_failed in LDK versions prior to 0.0.114
827
- ( 5 , * path, vec_type) ,
827
+ ( 4 , path. blinded_tail, option) ,
828
+ ( 5 , path. hops, vec_type) ,
828
829
( 7 , short_channel_id, option) ,
829
830
( 9 , None :: <RouteParameters >, option) , // retry in LDK versions prior to 0.0.115
830
831
( 11 , payment_id, option) ,
@@ -892,7 +893,8 @@ impl Writeable for Event {
892
893
write_tlv_fields ! ( writer, {
893
894
( 0 , payment_id, required) ,
894
895
( 2 , payment_hash, option) ,
895
- ( 4 , * path, vec_type)
896
+ ( 4 , path. hops, vec_type) ,
897
+ ( 6 , path. blinded_tail, option) ,
896
898
} )
897
899
} ,
898
900
& Event :: PaymentFailed { ref payment_id, ref payment_hash } => {
@@ -921,16 +923,18 @@ impl Writeable for Event {
921
923
write_tlv_fields ! ( writer, {
922
924
( 0 , payment_id, required) ,
923
925
( 2 , payment_hash, required) ,
924
- ( 4 , * path, vec_type)
926
+ ( 4 , path. hops, vec_type) ,
927
+ ( 6 , path. blinded_tail, option) ,
925
928
} )
926
929
} ,
927
930
& Event :: ProbeFailed { ref payment_id, ref payment_hash, ref path, ref short_channel_id } => {
928
931
23u8 . write ( writer) ?;
929
932
write_tlv_fields ! ( writer, {
930
933
( 0 , payment_id, required) ,
931
934
( 2 , payment_hash, required) ,
932
- ( 4 , * path, vec_type) ,
935
+ ( 4 , path. hops , vec_type) ,
933
936
( 6 , short_channel_id, option) ,
937
+ ( 8 , path. blinded_tail, option) ,
934
938
} )
935
939
} ,
936
940
& Event :: HTLCHandlingFailed { ref prev_channel_id, ref failed_next_destination } => {
@@ -1055,6 +1059,7 @@ impl MaybeReadable for Event {
1055
1059
let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
1056
1060
let mut payment_failed_permanently = false ;
1057
1061
let mut network_update = None ;
1062
+ let mut blinded_tail: Option < BlindedTail > = None ;
1058
1063
let mut path: Option < Vec < RouteHop > > = Some ( vec ! [ ] ) ;
1059
1064
let mut short_channel_id = None ;
1060
1065
let mut payment_id = None ;
@@ -1063,6 +1068,7 @@ impl MaybeReadable for Event {
1063
1068
( 0 , payment_hash, required) ,
1064
1069
( 1 , network_update, upgradable_option) ,
1065
1070
( 2 , payment_failed_permanently, required) ,
1071
+ ( 4 , blinded_tail, option) ,
1066
1072
( 5 , path, vec_type) ,
1067
1073
( 7 , short_channel_id, option) ,
1068
1074
( 11 , payment_id, option) ,
@@ -1074,7 +1080,7 @@ impl MaybeReadable for Event {
1074
1080
payment_hash,
1075
1081
payment_failed_permanently,
1076
1082
failure,
1077
- path : path. unwrap ( ) ,
1083
+ path : Path { hops : path. unwrap ( ) , blinded_tail } ,
1078
1084
short_channel_id,
1079
1085
#[ cfg( test) ]
1080
1086
error_code,
@@ -1177,18 +1183,16 @@ impl MaybeReadable for Event {
1177
1183
} ,
1178
1184
13u8 => {
1179
1185
let f = || {
1180
- let mut payment_id = PaymentId ( [ 0 ; 32 ] ) ;
1181
- let mut payment_hash = None ;
1182
- let mut path: Option < Vec < RouteHop > > = Some ( vec ! [ ] ) ;
1183
- read_tlv_fields ! ( reader, {
1186
+ _init_and_read_tlv_fields ! ( reader, {
1184
1187
( 0 , payment_id, required) ,
1185
1188
( 2 , payment_hash, option) ,
1186
1189
( 4 , path, vec_type) ,
1190
+ ( 6 , blinded_tail, option) ,
1187
1191
} ) ;
1188
1192
Ok ( Some ( Event :: PaymentPathSuccessful {
1189
- payment_id,
1193
+ payment_id : payment_id . 0 . unwrap ( ) ,
1190
1194
payment_hash,
1191
- path : path. unwrap ( ) ,
1195
+ path : Path { hops : path. unwrap ( ) , blinded_tail } ,
1192
1196
} ) )
1193
1197
} ;
1194
1198
f ( )
@@ -1235,38 +1239,33 @@ impl MaybeReadable for Event {
1235
1239
} ,
1236
1240
21u8 => {
1237
1241
let f = || {
1238
- let mut payment_id = PaymentId ( [ 0 ; 32 ] ) ;
1239
- let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
1240
- let mut path: Option < Vec < RouteHop > > = Some ( vec ! [ ] ) ;
1241
- read_tlv_fields ! ( reader, {
1242
+ _init_and_read_tlv_fields ! ( reader, {
1242
1243
( 0 , payment_id, required) ,
1243
1244
( 2 , payment_hash, required) ,
1244
1245
( 4 , path, vec_type) ,
1246
+ ( 6 , blinded_tail, option) ,
1245
1247
} ) ;
1246
1248
Ok ( Some ( Event :: ProbeSuccessful {
1247
- payment_id,
1248
- payment_hash,
1249
- path : path. unwrap ( ) ,
1249
+ payment_id : payment_id . 0 . unwrap ( ) ,
1250
+ payment_hash : payment_hash . 0 . unwrap ( ) ,
1251
+ path : Path { hops : path. unwrap ( ) , blinded_tail } ,
1250
1252
} ) )
1251
1253
} ;
1252
1254
f ( )
1253
1255
} ,
1254
1256
23u8 => {
1255
1257
let f = || {
1256
- let mut payment_id = PaymentId ( [ 0 ; 32 ] ) ;
1257
- let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
1258
- let mut path: Option < Vec < RouteHop > > = Some ( vec ! [ ] ) ;
1259
- let mut short_channel_id = None ;
1260
- read_tlv_fields ! ( reader, {
1258
+ _init_and_read_tlv_fields ! ( reader, {
1261
1259
( 0 , payment_id, required) ,
1262
1260
( 2 , payment_hash, required) ,
1263
1261
( 4 , path, vec_type) ,
1264
1262
( 6 , short_channel_id, option) ,
1263
+ ( 8 , blinded_tail, option) ,
1265
1264
} ) ;
1266
1265
Ok ( Some ( Event :: ProbeFailed {
1267
- payment_id,
1268
- payment_hash,
1269
- path : path. unwrap ( ) ,
1266
+ payment_id : payment_id . 0 . unwrap ( ) ,
1267
+ payment_hash : payment_hash . 0 . unwrap ( ) ,
1268
+ path : Path { hops : path. unwrap ( ) , blinded_tail } ,
1270
1269
short_channel_id,
1271
1270
} ) )
1272
1271
} ;
0 commit comments