From: Elias Rohrer Date: Thu, 31 Aug 2023 14:04:33 +0000 (+0200) Subject: Add constructor to `RouteParameters` X-Git-Tag: v0.0.117-alpha1~27^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b3612b83c41b56b9c2006db25686ebb8cfdd5aef;p=rust-lightning Add constructor to `RouteParameters` --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 79d54e22d..a279568cd 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -435,6 +435,13 @@ pub struct RouteParameters { pub final_value_msat: u64, } +impl RouteParameters { + /// Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. + pub fn from_payment_params_and_value(payment_params: PaymentParameters, final_value_msat: u64) -> Self { + Self { payment_params, final_value_msat } + } +} + impl Writeable for RouteParameters { fn write(&self, writer: &mut W) -> Result<(), io::Error> { write_tlv_fields!(writer, {