Drop unreachable underflow-handling block in route calculation
authorMatt Corallo <git@bluematt.me>
Sat, 27 Mar 2021 22:16:38 +0000 (18:16 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 7 Apr 2021 01:41:45 +0000 (21:41 -0400)
See comment in the removed block, note that the subsequent
subtraction will underflow if the block would otherwise have been
reached.

lightning/src/routing/router.rs

index dc51b58ee01df5fbe808a9180d188e5447ede9ff..c53e46157d5dc74941bb0dee94886a06f3d5f83f 100644 (file)
@@ -979,11 +979,6 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
                                        let mut spent_on_hop_msat = value_contribution_msat;
                                        let next_hops_fee_msat = payment_hop.next_hops_fee_msat;
                                        spent_on_hop_msat += next_hops_fee_msat;
-                                       if *channel_liquidity_available_msat < spent_on_hop_msat {
-                                               // This should not happen because we do recompute fees right before,
-                                               // trying to avoid cases when a hop is not usable due to the fee situation.
-                                               break 'path_construction;
-                                       }
                                        if spent_on_hop_msat == *channel_liquidity_available_msat {
                                                // If this path used all of this channel's available liquidity, we know
                                                // this path will not be selected again in the next loop iteration.