Skip to content

Commit 88af8a2

Browse files
committed
Do not compile the Simple* type aliases in c_bindings at all
Because the bindings changes now require further changes to our type definitions, avoiding building the `Simple*` type aliases entirely makes the patchset there simpler.
1 parent bbb8fac commit 88af8a2

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lightning/src/ln/channelmanager.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,8 @@ struct PendingInboundPayment {
827827
/// or, respectively, [`Router`] for its router, but this type alias chooses the concrete types
828828
/// of [`KeysManager`] and [`DefaultRouter`].
829829
///
830-
/// This is not exported to bindings users as Arcs don't make sense in bindings
830+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
831+
#[cfg(not(c_bindings))]
831832
pub type SimpleArcChannelManager<M, T, F, L> = ChannelManager<
832833
Arc<M>,
833834
Arc<T>,
@@ -855,7 +856,8 @@ pub type SimpleArcChannelManager<M, T, F, L> = ChannelManager<
855856
/// or, respectively, [`Router`] for its router, but this type alias chooses the concrete types
856857
/// of [`KeysManager`] and [`DefaultRouter`].
857858
///
858-
/// This is not exported to bindings users as Arcs don't make sense in bindings
859+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
860+
#[cfg(not(c_bindings))]
859861
pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L> =
860862
ChannelManager<
861863
&'a M,

lightning/src/ln/peer_handler.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ use crate::ln::ChannelId;
2424
use crate::ln::features::{InitFeatures, NodeFeatures};
2525
use crate::ln::msgs;
2626
use crate::ln::msgs::{ChannelMessageHandler, LightningError, SocketAddress, OnionMessageHandler, RoutingMessageHandler};
27+
#[cfg(not(c_bindings))]
2728
use crate::ln::channelmanager::{SimpleArcChannelManager, SimpleRefChannelManager};
2829
use crate::util::ser::{VecWriter, Writeable, Writer};
2930
use crate::ln::peer_channel_encryptor::{PeerChannelEncryptor,NextNoiseStep};
3031
use crate::ln::wire;
3132
use crate::ln::wire::{Encode, Type};
32-
use crate::onion_message::{CustomOnionMessageHandler, OffersMessage, OffersMessageHandler, OnionMessageContents, PendingOnionMessage, SimpleArcOnionMessenger, SimpleRefOnionMessenger};
33+
#[cfg(not(c_bindings))]
34+
use crate::onion_message::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
35+
use crate::onion_message::{CustomOnionMessageHandler, OffersMessage, OffersMessageHandler, OnionMessageContents, PendingOnionMessage};
3336
use crate::routing::gossip::{NetworkGraph, P2PGossipSync, NodeId, NodeAlias};
3437
use crate::util::atomic_counter::AtomicCounter;
3538
use crate::util::logger::Logger;
@@ -608,7 +611,8 @@ impl Peer {
608611
/// SimpleRefPeerManager is the more appropriate type. Defining these type aliases prevents
609612
/// issues such as overly long function definitions.
610613
///
611-
/// This is not exported to bindings users as `Arc`s don't make sense in bindings.
614+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
615+
#[cfg(not(c_bindings))]
612616
pub type SimpleArcPeerManager<SD, M, T, F, C, L> = PeerManager<
613617
SD,
614618
Arc<SimpleArcChannelManager<M, T, F, L>>,
@@ -626,7 +630,8 @@ pub type SimpleArcPeerManager<SD, M, T, F, C, L> = PeerManager<
626630
/// But if this is not necessary, using a reference is more efficient. Defining these type aliases
627631
/// helps with issues such as long function definitions.
628632
///
629-
/// This is not exported to bindings users as general type aliases don't make sense in bindings.
633+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
634+
#[cfg(not(c_bindings))]
630635
pub type SimpleRefPeerManager<
631636
'a, 'b, 'c, 'd, 'e, 'f, 'logger, 'h, 'i, 'j, 'graph, 'k, SD, M, T, F, C, L
632637
> = PeerManager<

lightning/src/onion_message/messenger.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::blinded_path::BlindedPath;
1919
use crate::blinded_path::message::{advance_path_by_one, ForwardTlvs, ReceiveTlvs};
2020
use crate::blinded_path::utils;
2121
use crate::sign::{EntropySource, KeysManager, NodeSigner, Recipient};
22+
#[cfg(not(c_bindings))]
2223
use crate::ln::channelmanager::{SimpleArcChannelManager, SimpleRefChannelManager};
2324
use crate::ln::features::{InitFeatures, NodeFeatures};
2425
use crate::ln::msgs::{self, OnionMessage, OnionMessageHandler};
@@ -712,10 +713,11 @@ where
712713
/// Useful for simplifying the parameters of [`SimpleArcChannelManager`] and
713714
/// [`SimpleArcPeerManager`]. See their docs for more details.
714715
///
715-
/// This is not exported to bindings users as `Arc`s don't make sense in bindings.
716+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
716717
///
717718
/// [`SimpleArcChannelManager`]: crate::ln::channelmanager::SimpleArcChannelManager
718719
/// [`SimpleArcPeerManager`]: crate::ln::peer_handler::SimpleArcPeerManager
720+
#[cfg(not(c_bindings))]
719721
pub type SimpleArcOnionMessenger<M, T, F, L> = OnionMessenger<
720722
Arc<KeysManager>,
721723
Arc<KeysManager>,
@@ -728,10 +730,11 @@ pub type SimpleArcOnionMessenger<M, T, F, L> = OnionMessenger<
728730
/// Useful for simplifying the parameters of [`SimpleRefChannelManager`] and
729731
/// [`SimpleRefPeerManager`]. See their docs for more details.
730732
///
731-
/// This is not exported to bindings users as general type aliases don't make sense in bindings.
733+
/// This is not exported to bindings users as type aliases aren't supported in most languages.
732734
///
733735
/// [`SimpleRefChannelManager`]: crate::ln::channelmanager::SimpleRefChannelManager
734736
/// [`SimpleRefPeerManager`]: crate::ln::peer_handler::SimpleRefPeerManager
737+
#[cfg(not(c_bindings))]
735738
pub type SimpleRefOnionMessenger<
736739
'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, M, T, F, L
737740
> = OnionMessenger<

0 commit comments

Comments
 (0)