Fix Router min HTLC comparison

This commit is contained in:
Matt Corallo 2018-10-02 13:46:03 -04:00
parent a48fb848d9
commit 4f4a5c06d2
2 changed files with 2 additions and 2 deletions

View 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);

View 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) })