]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add constructor to `RouteParameters`
authorElias Rohrer <dev@tnull.de>
Thu, 31 Aug 2023 14:04:33 +0000 (16:04 +0200)
committerElias Rohrer <dev@tnull.de>
Fri, 1 Sep 2023 08:35:42 +0000 (10:35 +0200)
lightning/src/routing/router.rs

index 79d54e22d6755896ee1c4ead6be0804413178a47..a279568cda8d77b38bafe478ff450e498283d641 100644 (file)
@@ -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<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
                write_tlv_fields!(writer, {