Skip to content

Commit 6413a45

Browse files
authored
Merge pull request #3286 from TheBlueMatt/2024-08-124-bindings
[0.0.124-bindings] Bindings-specific changes for 0.0.124
2 parents b023eed + 31b6b71 commit 6413a45

37 files changed

+149
-135
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ use lightning::events::MessageSendEventsProvider;
4747
use lightning::ln::channel::FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE;
4848
use lightning::ln::channel_state::ChannelDetails;
4949
use lightning::ln::channelmanager::{
50-
ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId, PaymentSendFailure,
51-
RecipientOnionFields,
50+
ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId,
5251
};
52+
use lightning::ln::outbound_payment::{RecipientOnionFields, PaymentSendFailure};
5353
use lightning::ln::functional_test_utils::*;
5454
use lightning::ln::msgs::{
5555
self, ChannelMessageHandler, CommitmentUpdate, DecodeError, Init, UpdateAddHTLC,

fuzz/src/full_stack.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ use lightning::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Listen};
4040
use lightning::events::Event;
4141
use lightning::ln::channel_state::ChannelDetails;
4242
use lightning::ln::channelmanager::{
43-
ChainParameters, ChannelManager, InterceptId, PaymentId, RecipientOnionFields, Retry,
43+
ChainParameters, ChannelManager, InterceptId, PaymentId,
4444
};
45+
use lightning::ln::outbound_payment::{RecipientOnionFields, Retry};
4546
use lightning::ln::functional_test_utils::*;
4647
use lightning::ln::msgs::{self, DecodeError};
4748
use lightning::ln::peer_handler::{

lightning-background-processor/src/lib.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ impl BackgroundProcessor {
925925
SC: for<'b> WriteableScore<'b>,
926926
>(
927927
persister: PS, event_handler: EH, chain_monitor: M, channel_manager: CM,
928-
onion_messenger: Option<OM>, gossip_sync: GossipSync<PGS, RGS, G, UL, L>, peer_manager: PM,
928+
onion_messenger: OM, gossip_sync: GossipSync<PGS, RGS, G, UL, L>, peer_manager: PM,
929929
logger: L, scorer: Option<S>,
930930
) -> Self
931931
where
@@ -962,34 +962,27 @@ impl BackgroundProcessor {
962962
}
963963
event_handler.handle_event(event)
964964
};
965+
let om_opt = Some(&*onion_messenger);
965966
define_run_body!(
966967
persister,
967968
chain_monitor,
968969
chain_monitor.process_pending_events(&event_handler),
969970
channel_manager,
970971
channel_manager.get_cm().process_pending_events(&event_handler),
971-
onion_messenger,
972-
if let Some(om) = &onion_messenger {
973-
om.get_om().process_pending_events(&event_handler)
974-
},
972+
om_opt,
973+
onion_messenger.get_om().process_pending_events(&event_handler),
975974
peer_manager,
976975
gossip_sync,
977976
logger,
978977
scorer,
979978
stop_thread.load(Ordering::Acquire),
980979
{
981-
let sleeper = if let Some(om) = onion_messenger.as_ref() {
980+
let sleeper =
982981
Sleeper::from_three_futures(
983982
&channel_manager.get_cm().get_event_or_persistence_needed_future(),
984983
&chain_monitor.get_update_future(),
985-
&om.get_om().get_update_future(),
986-
)
987-
} else {
988-
Sleeper::from_two_futures(
989-
&channel_manager.get_cm().get_event_or_persistence_needed_future(),
990-
&chain_monitor.get_update_future(),
991-
)
992-
};
984+
&onion_messenger.get_om().get_update_future(),
985+
);
993986
sleeper.wait_timeout(Duration::from_millis(100));
994987
},
995988
|_| Instant::now(),
@@ -1141,8 +1134,6 @@ mod tests {
11411134
Arc<test_utils::TestLogger>,
11421135
Arc<KeysManager>,
11431136
Arc<LockingWrapper<TestScorer>>,
1144-
(),
1145-
TestScorer,
11461137
>,
11471138
>,
11481139
Arc<test_utils::TestLogger>,
@@ -1404,10 +1395,10 @@ mod tests {
14041395
}
14051396

14061397
impl ScoreLookUp for TestScorer {
1398+
#[cfg(not(c_bindings))]
14071399
type ScoreParams = ();
14081400
fn channel_penalty_msat(
1409-
&self, _candidate: &CandidateRouteHop, _usage: ChannelUsage,
1410-
_score_params: &Self::ScoreParams,
1401+
&self, _candidate: &CandidateRouteHop, _usage: ChannelUsage, _score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters
14111402
) -> u64 {
14121403
unimplemented!();
14131404
}

lightning-transaction-sync/src/electrum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Chain sync using the electrum protocol
2+
13
use crate::common::{ConfirmedTx, FilterQueue, SyncState};
24
use crate::error::{InternalError, TxSyncError};
35

lightning-transaction-sync/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Common error types
2+
13
use std::fmt;
24

35
#[derive(Debug)]

lightning-transaction-sync/src/esplora.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Chain sync using the Esplora API
2+
13
use crate::common::{ConfirmedTx, FilterQueue, SyncState};
24
use crate::error::{InternalError, TxSyncError};
35

lightning-transaction-sync/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
extern crate bdk_macros;
7070

7171
#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
72-
mod esplora;
72+
pub mod esplora;
7373

7474
#[cfg(any(feature = "electrum"))]
75-
mod electrum;
75+
pub mod electrum;
7676

7777
#[cfg(any(feature = "esplora-blocking", feature = "esplora-async", feature = "electrum"))]
7878
mod common;
7979
#[cfg(any(feature = "esplora-blocking", feature = "esplora-async", feature = "electrum"))]
80-
mod error;
80+
pub mod error;
8181
#[cfg(any(feature = "esplora-blocking", feature = "esplora-async", feature = "electrum"))]
8282
pub use error::TxSyncError;
8383

lightning-types/src/features.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ pub struct Features<T: sealed::Context> {
602602
mark: PhantomData<T>,
603603
}
604604

605+
/// This is not exported to bindings users but probably should be.
605606
impl<T: sealed::Context, Rhs: Borrow<Self>> core::ops::BitOrAssign<Rhs> for Features<T> {
606607
fn bitor_assign(&mut self, rhs: Rhs) {
607608
let total_feature_len = cmp::max(self.flags.len(), rhs.borrow().flags.len());
@@ -612,6 +613,7 @@ impl<T: sealed::Context, Rhs: Borrow<Self>> core::ops::BitOrAssign<Rhs> for Feat
612613
}
613614
}
614615

616+
/// This is not exported to bindings users but probably should be.
615617
impl<T: sealed::Context> core::ops::BitOr for Features<T> {
616618
type Output = Self;
617619

lightning/src/blinded_path/message.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ impl BlindedMessagePath {
142142
/// introduction node.
143143
///
144144
/// Will only modify `self` when returning `Ok`.
145-
pub fn advance_path_by_one<NS: Deref, NL: Deref, T>(
145+
pub fn advance_path_by_one<NS: Deref, NL: Deref, T: secp256k1::Signing + secp256k1::Verification>(
146146
&mut self, node_signer: &NS, node_id_lookup: &NL, secp_ctx: &Secp256k1<T>
147147
) -> Result<(), ()>
148148
where
149149
NS::Target: NodeSigner,
150150
NL::Target: NodeIdLookUp,
151-
T: secp256k1::Signing + secp256k1::Verification,
152151
{
153152
let control_tlvs_ss = node_signer.ecdh(Recipient::Node, &self.0.blinding_point, None)?;
154153
let rho = onion_utils::gen_rho_from_shared_secret(&control_tlvs_ss.secret_bytes());
@@ -334,7 +333,7 @@ pub enum OffersContext {
334333
/// used with an [`InvoiceError`].
335334
///
336335
/// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
337-
hmac: Option<Hmac<Sha256>>,
336+
hmac: Option<[u8; 32]>,
338337
},
339338
/// Context used by a [`BlindedMessagePath`] as a reply path for a [`Bolt12Invoice`].
340339
///

lightning/src/blinded_path/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ impl_writeable!(BlindedHop, {
185185

186186
impl Direction {
187187
/// Returns the [`NodeId`] from the inputs corresponding to the direction.
188-
pub fn select_node_id(&self, node_a: NodeId, node_b: NodeId) -> NodeId {
188+
pub(crate) fn select_node_id(&self, node_a: NodeId, node_b: NodeId) -> NodeId {
189189
match self {
190190
Direction::NodeOne => core::cmp::min(node_a, node_b),
191191
Direction::NodeTwo => core::cmp::max(node_a, node_b),
192192
}
193193
}
194194

195195
/// Returns the [`PublicKey`] from the inputs corresponding to the direction.
196-
pub fn select_pubkey<'a>(&self, node_a: &'a PublicKey, node_b: &'a PublicKey) -> &'a PublicKey {
196+
pub(crate) fn select_pubkey<'a>(&self, node_a: &'a PublicKey, node_b: &'a PublicKey) -> &'a PublicKey {
197197
let (node_one, node_two) = if NodeId::from_pubkey(node_a) < NodeId::from_pubkey(node_b) {
198198
(node_a, node_b)
199199
} else {

0 commit comments

Comments
 (0)