From b3612b83c41b56b9c2006db25686ebb8cfdd5aef Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 31 Aug 2023 16:04:33 +0200 Subject: [PATCH] Add constructor to `RouteParameters` --- lightning/src/routing/router.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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, { -- 2.39.5