]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix Router min HTLC comparison 2018-10-router-htlc-min
authorMatt Corallo <git@bluematt.me>
Tue, 2 Oct 2018 17:46:03 +0000 (13:46 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 22 Jan 2019 17:22:40 +0000 (12:22 -0500)
src/ln/functional_tests.rs
src/ln/router.rs

index eeff90e291a283e75b47ce40b55f039262b7089c..551b9de70187fc8a639421378ef4cda3a919461d 100644 (file)
@@ -6724,7 +6724,7 @@ fn test_update_add_htlc_bolt2_receiver_check_amount_received_more_than_min() {
                let channel = chan_lock.by_id.get(&chan.2).unwrap();
                htlc_minimum_msat = channel.get_our_htlc_minimum_msat();
        }
-       let route = nodes[0].router.get_route(&nodes[1].node.get_our_node_id(), None, &[], htlc_minimum_msat+1, TEST_FINAL_CLTV).unwrap();
+       let route = nodes[0].router.get_route(&nodes[1].node.get_our_node_id(), None, &[], htlc_minimum_msat, TEST_FINAL_CLTV).unwrap();
        let (_, our_payment_hash) = get_payment_preimage_hash!(nodes[0]);
        nodes[0].node.send_payment(route, our_payment_hash).unwrap();
        check_added_monitors!(nodes[0], 1);
index 3920d44fc7abddc65c94edab16cc864e0e6f4747..12b3e43f553a5fe82fe91578b76d4c9eeb8e5b5e 100644 (file)
@@ -708,7 +708,7 @@ impl Router {
                        // $directional_info.
                        ( $chan_id: expr, $dest_node_id: expr, $directional_info: expr, $starting_fee_msat: expr ) => {
                                //TODO: Explore simply adding fee to hit htlc_minimum_msat
-                               if $starting_fee_msat as u64 + final_value_msat > $directional_info.htlc_minimum_msat {
+                               if $starting_fee_msat as u64 + final_value_msat >= $directional_info.htlc_minimum_msat {
                                        let proportional_fee_millions = ($starting_fee_msat + final_value_msat).checked_mul($directional_info.fee_proportional_millionths as u64);
                                        if let Some(new_fee) = proportional_fee_millions.and_then(|part| {
                                                        ($directional_info.fee_base_msat as u64).checked_add(part / 1000000) })