@@ -18,13 +18,15 @@ use crate::blinded_path::payment::{
18
18
} ;
19
19
use crate :: blinded_path:: { BlindedHop , Direction , IntroductionNode } ;
20
20
use crate :: crypto:: chacha20:: ChaCha20 ;
21
+ use crate :: io;
21
22
use crate :: ln:: channel_state:: ChannelDetails ;
22
23
use crate :: ln:: channelmanager:: { PaymentId , RecipientOnionFields , MIN_FINAL_CLTV_EXPIRY_DELTA } ;
23
24
use crate :: ln:: msgs:: { DecodeError , MAX_VALUE_MSAT } ;
24
25
use crate :: ln:: onion_utils;
25
26
use crate :: offers:: invoice:: Bolt12Invoice ;
26
27
#[ cfg( async_payments) ]
27
28
use crate :: offers:: static_invoice:: StaticInvoice ;
29
+ use crate :: prelude:: * ;
28
30
use crate :: routing:: gossip:: {
29
31
DirectedChannelInfo , EffectiveCapacity , NetworkGraph , NodeId , ReadOnlyNetworkGraph ,
30
32
} ;
@@ -37,8 +39,6 @@ use crate::types::features::{
37
39
use crate :: types:: payment:: { PaymentHash , PaymentPreimage } ;
38
40
use crate :: util:: logger:: Logger ;
39
41
use crate :: util:: ser:: { Readable , ReadableArgs , Writeable , Writer } ;
40
- use crate :: io;
41
- use crate :: prelude:: * ;
42
42
use alloc:: collections:: BinaryHeap ;
43
43
use core:: ops:: Deref ;
44
44
use core:: { cmp, fmt} ;
@@ -3726,23 +3726,22 @@ where L::Target: Logger {
3726
3726
Ok ( route)
3727
3727
}
3728
3728
3729
- fn create_self_payment_route ( our_node_pubkey : & PublicKey , route_params : & RouteParameters ) -> Result < Route , & ' static str > {
3729
+ fn create_self_payment_route (
3730
+ our_node_pubkey : & PublicKey , route_params : & RouteParameters ,
3731
+ ) -> Result < Route , & ' static str > {
3730
3732
let path = Path {
3731
- hops : vec ! [ RouteHop {
3732
- pubkey: our_node_pubkey. clone( ) ,
3733
- short_channel_id: 0 , // Dummy short_channel_id specifying self payment
3734
- fee_msat: 0 , // Zero fees
3735
- cltv_expiry_delta: MIN_FINAL_CLTV_EXPIRY_DELTA . into( ) ,
3736
- node_features: NodeFeatures :: empty( ) ,
3737
- channel_features: ChannelFeatures :: empty( ) ,
3738
- maybe_announced_channel: false ,
3739
- } ] ,
3740
- blinded_tail : None ,
3741
- } ;
3742
- Ok ( Route {
3743
- paths : vec ! [ path] ,
3744
- route_params : Some ( route_params. clone ( ) ) ,
3745
- } )
3733
+ hops : vec ! [ RouteHop {
3734
+ pubkey: our_node_pubkey. clone( ) ,
3735
+ short_channel_id: 0 , // Dummy short_channel_id specifying self payment
3736
+ fee_msat: route_params. final_value_msat, // last hop send the entire amount
3737
+ cltv_expiry_delta: MIN_FINAL_CLTV_EXPIRY_DELTA . into( ) ,
3738
+ node_features: NodeFeatures :: empty( ) ,
3739
+ channel_features: ChannelFeatures :: empty( ) ,
3740
+ maybe_announced_channel: false ,
3741
+ } ] ,
3742
+ blinded_tail : None ,
3743
+ } ;
3744
+ Ok ( Route { paths : vec ! [ path] , route_params : Some ( route_params. clone ( ) ) } )
3746
3745
}
3747
3746
3748
3747
// When an adversarial intermediary node observes a payment, it may be able to infer its
0 commit comments