From: Gleb Naumenko Date: Tue, 16 Jun 2020 15:58:06 +0000 (+0300) Subject: Use constant for max msats X-Git-Tag: v0.0.12~46^2~6 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5309197150597b6b8a83fcc98090a955bb252d56;p=rust-lightning Use constant for max msats --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index d82f8293f..5f3f02dcf 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -7,7 +7,7 @@ use bitcoin::secp256k1::key::PublicKey; use ln::channelmanager; use ln::features::{ChannelFeatures, NodeFeatures}; -use ln::msgs::{DecodeError,ErrorAction,LightningError}; +use ln::msgs::{DecodeError, ErrorAction, LightningError, MAX_VALUE_MSAT}; use routing::network_graph::{NetworkGraph, RoutingFees}; use util::ser::{Writeable, Readable}; use util::logger::Logger; @@ -168,7 +168,7 @@ pub fn get_route(our_node_id: &PublicKey, network: &NetworkGraph, targ return Err(LightningError{err: "Cannot generate a route to ourselves".to_owned(), action: ErrorAction::IgnoreError}); } - if final_value_msat > 21_000_000 * 1_0000_0000 * 1000 { + if final_value_msat > MAX_VALUE_MSAT { return Err(LightningError{err: "Cannot generate a route of more value than all existing satoshis".to_owned(), action: ErrorAction::IgnoreError}); }