Skip to content

Commit 704d21a

Browse files
f calculate value in test
1 parent 124003b commit 704d21a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,13 @@ fn min_htlc() {
10851085
let chan_1_2 = create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0);
10861086
let chan_2_3 = create_announced_chan_between_nodes_with_value(&nodes, 2, 3, 1_000_000, 0);
10871087

1088-
let min_htlc_msat = 4174; // the resulting htlc min
1088+
let min_htlc_msat = {
1089+
// The min htlc for this setup is nodes[2]'s htlc_minimum_msat minus the
1090+
// following fees.
1091+
let post_base_fee = chan_2_3.1.contents.htlc_minimum_msat - chan_2_3.0.contents.fee_base_msat as u64;
1092+
let prop_fee = chan_2_3.0.contents.fee_proportional_millionths as u64;
1093+
(post_base_fee * 1_000_000 + 1_000_000 + prop_fee - 1) / (prop_fee + 1_000_000)
1094+
};
10891095
let (payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash(&nodes[3], Some(min_htlc_msat), None);
10901096
let mut route_params = get_blinded_route_parameters(
10911097
min_htlc_msat, payment_secret, chan_1_2.1.contents.htlc_minimum_msat,

0 commit comments

Comments
 (0)