Skip to content

Commit fc93106

Browse files
Include min_final_cltv when generating invoices
1 parent c4d0cc3 commit fc93106

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cli.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ fn get_invoice(
588588

589589
// Add route hints to the invoice.
590590
let our_channels = channel_manager.list_usable_channels();
591+
let mut min_final_cltv_expiry = 9;
591592
for channel in our_channels {
592593
let short_channel_id = match channel.short_channel_id {
593594
Some(id) => id.to_be_bytes(),
@@ -597,6 +598,9 @@ fn get_invoice(
597598
Some(info) => info,
598599
None => continue,
599600
};
601+
if forwarding_info.cltv_expiry_delta > min_final_cltv_expiry {
602+
min_final_cltv_expiry = forwarding_info.cltv_expiry_delta;
603+
}
600604
invoice = invoice.route(vec![lightning_invoice::RouteHop {
601605
pubkey: channel.remote_network_id,
602606
short_channel_id,
@@ -605,6 +609,7 @@ fn get_invoice(
605609
cltv_expiry_delta: forwarding_info.cltv_expiry_delta,
606610
}]);
607611
}
612+
invoice = invoice.min_final_cltv_expiry(min_final_cltv_expiry.into());
608613

609614
// Sign the invoice.
610615
let invoice =

0 commit comments

Comments
 (0)