]> git.bitcoin.ninja Git - rust-lightning/commitdiff
CounterpartyForwardingInfo to PaymentRelay mapping
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 8 Dec 2023 18:01:58 +0000 (12:01 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 15 Dec 2023 21:40:09 +0000 (15:40 -0600)
lightning/src/blinded_path/payment.rs

index 7b604fbdcb1d8af0a6dffbdfd40b1898d7d19d52..f4df1e379d931b3ac65cbcdae65441c629554c6c 100644 (file)
@@ -8,6 +8,7 @@ use crate::blinded_path::BlindedHop;
 use crate::blinded_path::utils;
 use crate::io;
 use crate::ln::PaymentSecret;
+use crate::ln::channelmanager::CounterpartyForwardingInfo;
 use crate::ln::features::BlindedHopFeatures;
 use crate::ln::msgs::DecodeError;
 use crate::offers::invoice::BlindedPayInfo;
@@ -96,6 +97,15 @@ pub struct PaymentConstraints {
        pub htlc_minimum_msat: u64,
 }
 
+impl From<CounterpartyForwardingInfo> for PaymentRelay {
+       fn from(info: CounterpartyForwardingInfo) -> Self {
+               let CounterpartyForwardingInfo {
+                       fee_base_msat, fee_proportional_millionths, cltv_expiry_delta
+               } = info;
+               Self { cltv_expiry_delta, fee_proportional_millionths, fee_base_msat }
+       }
+}
+
 impl Writeable for ForwardTlvs {
        fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
                encode_tlv_stream!(w, {