Skip to content

Commit 9bb4402

Browse files
committed
DirectedChannelInfo to PaymentRelay mapping
1 parent 8231ed5 commit 9bb4402

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::ln::features::BlindedHopFeatures;
1313
use crate::ln::msgs::DecodeError;
1414
use crate::offers::invoice::BlindedPayInfo;
1515
use crate::prelude::*;
16+
use crate::routing::gossip::DirectedChannelInfo;
1617
use crate::util::ser::{Readable, Writeable, Writer};
1718

1819
use core::convert::TryFrom;
@@ -106,6 +107,17 @@ impl From<CounterpartyForwardingInfo> for PaymentRelay {
106107
}
107108
}
108109

110+
impl<'a> From<DirectedChannelInfo<'a>> for PaymentRelay {
111+
fn from(info: DirectedChannelInfo<'a>) -> Self {
112+
let direction = info.direction();
113+
Self {
114+
cltv_expiry_delta: direction.cltv_expiry_delta,
115+
fee_proportional_millionths: direction.fees.proportional_millionths,
116+
fee_base_msat: direction.fees.base_msat,
117+
}
118+
}
119+
}
120+
109121
impl Writeable for ForwardTlvs {
110122
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
111123
encode_tlv_stream!(w, {

lightning/src/routing/gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ impl<'a> DirectedChannelInfo<'a> {
10261026

10271027
/// Returns information for the direction.
10281028
#[inline]
1029-
pub(super) fn direction(&self) -> &'a ChannelUpdateInfo { self.direction }
1029+
pub(crate) fn direction(&self) -> &'a ChannelUpdateInfo { self.direction }
10301030

10311031
/// Returns the `node_id` of the source hop.
10321032
///

0 commit comments

Comments
 (0)