Skip to content

Commit 3f9efe7

Browse files
committed
Move CounterpartyForwardingInfo from channel to channelmanager
CounterpartyForwardingInfo is public (previously exposed with a `pub use`), and used inside of ChannelCounterparty in channelmanager.rs. However, it is defined in channel.rs, away from where it is used. This would be fine, except that the bindings generator is somewhat confused by this - it doesn't currently support interpreting `pub use` as a struct to expose, instead ignoring it. Fixes lightningdevkit/ldk-garbagecollected#44
1 parent de9fba8 commit 3f9efe7

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

lightning/src/ln/channel.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use ln::features::{ChannelFeatures, InitFeatures};
2727
use ln::msgs;
2828
use ln::msgs::{DecodeError, OptionalField, DataLossProtect};
2929
use ln::script::ShutdownScript;
30-
use ln::channelmanager::{PendingHTLCStatus, HTLCSource, HTLCFailReason, HTLCFailureMsg, PendingHTLCInfo, RAACommitmentOrder, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA, MAX_LOCAL_BREAKDOWN_TIMEOUT};
30+
use ln::channelmanager::{CounterpartyForwardingInfo, PendingHTLCStatus, HTLCSource, HTLCFailReason, HTLCFailureMsg, PendingHTLCInfo, RAACommitmentOrder, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA, MAX_LOCAL_BREAKDOWN_TIMEOUT};
3131
use ln::chan_utils::{CounterpartyCommitmentSecrets, TxCreationKeys, HTLCOutputInCommitment, HTLC_SUCCESS_TX_WEIGHT, HTLC_TIMEOUT_TX_WEIGHT, make_funding_redeemscript, ChannelPublicKeys, CommitmentTransaction, HolderCommitmentTransaction, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, MAX_HTLCS, get_commitment_transaction_number_obscure_factor, ClosingTransaction};
3232
use ln::chan_utils;
3333
use chain::BestBlock;
@@ -310,19 +310,6 @@ impl HTLCCandidate {
310310
}
311311
}
312312

313-
/// Information needed for constructing an invoice route hint for this channel.
314-
#[derive(Clone, Debug, PartialEq)]
315-
pub struct CounterpartyForwardingInfo {
316-
/// Base routing fee in millisatoshis.
317-
pub fee_base_msat: u32,
318-
/// Amount in millionths of a satoshi the channel will charge per transferred satoshi.
319-
pub fee_proportional_millionths: u32,
320-
/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
321-
/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
322-
/// `cltv_expiry_delta` for more details.
323-
pub cltv_expiry_delta: u16,
324-
}
325-
326313
/// A return value enum for get_update_fulfill_htlc. See UpdateFulfillCommitFetch variants for
327314
/// description
328315
enum UpdateFulfillFetch {

lightning/src/ln/channelmanager.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use chain::transaction::{OutPoint, TransactionData};
4343
// Since this struct is returned in `list_channels` methods, expose it here in case users want to
4444
// construct one themselves.
4545
use ln::{PaymentHash, PaymentPreimage, PaymentSecret};
46-
pub use ln::channel::CounterpartyForwardingInfo;
4746
use ln::channel::{Channel, ChannelError, ChannelUpdateStatus, UpdateFulfillCommitFetch};
4847
use ln::features::{InitFeatures, NodeFeatures};
4948
use routing::router::{Route, RouteHop};
@@ -626,6 +625,19 @@ const CHECK_CLTV_EXPIRY_SANITY: u32 = MIN_CLTV_EXPIRY_DELTA as u32 - LATENCY_GRA
626625
#[allow(dead_code)]
627626
const CHECK_CLTV_EXPIRY_SANITY_2: u32 = MIN_CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_PERIOD_BLOCKS - 2*CLTV_CLAIM_BUFFER;
628627

628+
/// Information needed for constructing an invoice route hint for this channel.
629+
#[derive(Clone, Debug, PartialEq)]
630+
pub struct CounterpartyForwardingInfo {
631+
/// Base routing fee in millisatoshis.
632+
pub fee_base_msat: u32,
633+
/// Amount in millionths of a satoshi the channel will charge per transferred satoshi.
634+
pub fee_proportional_millionths: u32,
635+
/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
636+
/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
637+
/// `cltv_expiry_delta` for more details.
638+
pub cltv_expiry_delta: u16,
639+
}
640+
629641
/// Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
630642
/// to better separate parameters.
631643
#[derive(Clone, Debug, PartialEq)]

0 commit comments

Comments
 (0)