projects
/
ldk-sample
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b17e298
)
Include min_final_cltv when generating invoices
author
Valentine Wallace
<vwallace@protonmail.com>
Fri, 2 Apr 2021 19:36:17 +0000
(15:36 -0400)
committer
Valentine Wallace
<vwallace@protonmail.com>
Mon, 3 May 2021 22:31:02 +0000
(18:31 -0400)
src/cli.rs
patch
|
blob
|
history
diff --git
a/src/cli.rs
b/src/cli.rs
index d22f549db02b40761ae638da1f179f1d05764b35..0144c001022662d7da6890cda460b24b30edc243 100644
(file)
--- a/
src/cli.rs
+++ b/
src/cli.rs
@@
-588,6
+588,7
@@
fn get_invoice(
// Add route hints to the invoice.
let our_channels = channel_manager.list_usable_channels();
// Add route hints to the invoice.
let our_channels = channel_manager.list_usable_channels();
+ let mut min_final_cltv_expiry = 9;
for channel in our_channels {
let short_channel_id = match channel.short_channel_id {
Some(id) => id.to_be_bytes(),
for channel in our_channels {
let short_channel_id = match channel.short_channel_id {
Some(id) => id.to_be_bytes(),
@@
-597,6
+598,9
@@
fn get_invoice(
Some(info) => info,
None => continue,
};
Some(info) => info,
None => continue,
};
+ if forwarding_info.cltv_expiry_delta > min_final_cltv_expiry {
+ min_final_cltv_expiry = forwarding_info.cltv_expiry_delta;
+ }
invoice = invoice.route(vec![lightning_invoice::RouteHop {
pubkey: channel.remote_network_id,
short_channel_id,
invoice = invoice.route(vec![lightning_invoice::RouteHop {
pubkey: channel.remote_network_id,
short_channel_id,
@@
-605,6
+609,7
@@
fn get_invoice(
cltv_expiry_delta: forwarding_info.cltv_expiry_delta,
}]);
}
cltv_expiry_delta: forwarding_info.cltv_expiry_delta,
}]);
}
+ invoice = invoice.min_final_cltv_expiry(min_final_cltv_expiry.into());
// Sign the invoice.
let invoice =
// Sign the invoice.
let invoice =