Drop Deref indirection for Logger
What changed, and why it matters
This is a large but straightforward internal refactoring of the Rust Lightning code. It removes an extra layer of pointer indirection (the Deref trait) from how the Logger type is passed around, replacing it with direct Logger trait bounds. The commit message says the goal is to reduce generics and verbosity while keeping the same behavior. There is no change to cryptographic logic, network protocol handling, or security-sensitive operations.
No security action required. Treat as normal code-quality refactoring; review for compile/test regressions only.
Security signals we found
No security-relevant code changes detected
Pure refactoring: trait bound simplification only
No changes to cryptographic, consensus, or networking logic
No new dependencies or unsafe blocks introduced
Evidence from the diff
The commit changes generic bounds across ~30 files from L: Deref where L::Target: Logger to L: Logger. It also removes the L associated type from AChannelManager and updates a test logger to no longer implement Deref. Call sites that previously dereferenced loggers (e.g., &*self.logger) are changed to direct references (&self.logger). This is a type-system cleanup that simplifies trait bounds and removes boilerplate. No functional behavior changes are visible in the diff.
Changed components
lightning/src/util/logger.rslightning/src/ln/channel.rslightning/src/ln/channelmanager.rslightning/src/chain/chainmonitor.rslightning/src/chain/channelmonitor.rslightning-background-processor/src/lib.rslightning-rapid-gossip-synclightning-transaction-synclightning-dns-resolver test utilitiesInspect captured patch +490 / −1071
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index 3255d26..79a3b95 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -201,10 +201,9 @@ pub enum GossipSync<
R: Deref<Target = RapidGossipSync<G, L>>,
G: Deref<Target = NetworkGraph<L>>,
U: Deref,
- L: Deref,
+ L: Logger,
> where
U::Target: UtxoLookup,
- L::Target: Logger,
{
/// Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
P2P(P),
@@ -219,11 +218,10 @@ impl<
R: Deref<Target = RapidGossipSync<G, L>>,
G: Deref<Target = NetworkGraph<L>>,
U: Deref,
- L: Deref,
+ L: Logger,
> GossipSync<P, R, G, U, L>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
fn network_graph(&self) -> Option<&G> {
match self {
@@ -261,11 +259,10 @@ impl<
P: Deref<Target = P2PGossipSync<G, U, L>>,
G: Deref<Target = NetworkGraph<L>>,
U: Deref,
- L: Deref,
+ L: Logger,
> GossipSync<P, &RapidGossipSync<G, L>, G, U, L>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
/// Initializes a new [`GossipSync::P2P`] variant.
pub fn p2p(gossip_sync: P) -> Self {
@@ -278,7 +275,7 @@ impl<
'a,
R: Deref<Target = RapidGossipSync<G, L>>,
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
>
GossipSync<
&P2PGossipSync<G, &'a (dyn UtxoLookup + Send + Sync), L>,
@@ -286,8 +283,7 @@ impl<
G,
&'a (dyn UtxoLookup + Send + Sync),
L,
- > where
- L::Target: Logger,
+ >
{
/// Initializes a new [`GossipSync::Rapid`] variant.
pub fn rapid(gossip_sync: R) -> Self {
@@ -296,15 +292,14 @@ impl<
}
/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
-impl<'a, L: Deref>
+impl<'a, L: Logger>
GossipSync<
&P2PGossipSync<&'a NetworkGraph<L>, &'a (dyn UtxoLookup + Send + Sync), L>,
&RapidGossipSync<&'a NetworkGraph<L>, L>,
&'a NetworkGraph<L>,
&'a (dyn UtxoLookup + Send + Sync),
L,
- > where
- L::Target: Logger,
+ >
{
/// Initializes a new [`GossipSync::None`] variant.
pub fn none() -> Self {
@@ -312,10 +307,7 @@ impl<'a, L: Deref>
}
}
-fn handle_network_graph_update<L: Deref>(network_graph: &NetworkGraph<L>, event: &Event)
-where
- L::Target: Logger,
-{
+fn handle_network_graph_update<L: Logger>(network_graph: &NetworkGraph<L>, event: &Event) {
if let Event::PaymentPathFailed {
failure: PathFailure::OnPath { network_update: Some(ref upd) },
..
@@ -422,8 +414,7 @@ pub const NO_ONION_MESSENGER: Option<
dyn AOnionMessenger<
EntropySource = &(dyn EntropySource + Send + Sync),
NodeSigner = &(dyn lightning::sign::NodeSigner + Send + Sync),
- Logger = dyn Logger + Send + Sync,
- L = &'static (dyn Logger + Send + Sync),
+ Logger = &'static (dyn Logger + Send + Sync),
NodeIdLookUp = DynChannelManager,
NL = &'static DynChannelManager,
MessageRouter = &'static DynMessageRouter,
@@ -950,7 +941,7 @@ pub async fn process_events_async<
T: BroadcasterInterface,
F: FeeEstimator,
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
P: Deref,
EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
EventHandler: Fn(Event) -> EventHandlerFuture,
@@ -980,7 +971,6 @@ pub async fn process_events_async<
where
UL::Target: UtxoLookup,
CF::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<<CM::Target as AChannelManager>::Signer>,
CM::Target: AChannelManager,
OM::Target: AOnionMessenger,
@@ -1448,7 +1438,7 @@ pub async fn process_events_async_with_kv_store_sync<
T: BroadcasterInterface,
F: FeeEstimator,
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
P: Deref,
EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
EventHandler: Fn(Event) -> EventHandlerFuture,
@@ -1478,7 +1468,6 @@ pub async fn process_events_async_with_kv_store_sync<
where
UL::Target: UtxoLookup,
CF::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<<CM::Target as AChannelManager>::Signer>,
CM::Target: AChannelManager,
OM::Target: AOnionMessenger,
diff --git a/lightning-dns-resolver/src/lib.rs b/lightning-dns-resolver/src/lib.rs
index 62b30bf..925e658 100644
--- a/lightning-dns-resolver/src/lib.rs
+++ b/lightning-dns-resolver/src/lib.rs
@@ -196,12 +196,6 @@ mod test {
eprintln!("{:<8} {}", self.node, record);
}
}
- impl Deref for TestLogger {
- type Target = TestLogger;
- fn deref(&self) -> &TestLogger {
- self
- }
- }
struct DummyNodeLookup {}
impl NodeIdLookUp for DummyNodeLookup {
diff --git a/lightning-rapid-gossip-sync/src/lib.rs b/lightning-rapid-gossip-sync/src/lib.rs
index 429a356..a965375 100644
--- a/lightning-rapid-gossip-sync/src/lib.rs
+++ b/lightning-rapid-gossip-sync/src/lib.rs
@@ -132,19 +132,13 @@ impl From<LightningError> for GraphSyncError {
/// See [crate-level documentation] for usage.
///
/// [crate-level documentation]: crate
-pub struct RapidGossipSync<NG: Deref<Target = NetworkGraph<L>>, L: Deref>
-where
- L::Target: Logger,
-{
+pub struct RapidGossipSync<NG: Deref<Target = NetworkGraph<L>>, L: Logger> {
network_graph: NG,
logger: L,
is_initial_sync_complete: AtomicBool,
}
-impl<NG: Deref<Target = NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L>
-where
- L::Target: Logger,
-{
+impl<NG: Deref<Target = NetworkGraph<L>>, L: Logger> RapidGossipSync<NG, L> {
/// Instantiate a new [`RapidGossipSync`] instance.
pub fn new(network_graph: NG, logger: L) -> Self {
Self { network_graph, logger, is_initial_sync_complete: AtomicBool::new(false) }
diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs
index 8319506..9d32879 100644
--- a/lightning-rapid-gossip-sync/src/processing.rs
+++ b/lightning-rapid-gossip-sync/src/processing.rs
@@ -37,10 +37,7 @@ const MAX_INITIAL_NODE_ID_VECTOR_CAPACITY: u32 = 50_000;
/// suggestion.
const STALE_RGS_UPDATE_AGE_LIMIT_SECS: u64 = 60 * 60 * 24 * 14;
-impl<NG: Deref<Target = NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L>
-where
- L::Target: Logger,
-{
+impl<NG: Deref<Target = NetworkGraph<L>>, L: Logger> RapidGossipSync<NG, L> {
#[cfg(feature = "std")]
pub(crate) fn update_network_graph_from_byte_stream<R: io::Read>(
&self, read_cursor: &mut R,
diff --git a/lightning-transaction-sync/src/electrum.rs b/lightning-transaction-sync/src/electrum.rs
index 1162b9c..1905456 100644
--- a/lightning-transaction-sync/src/electrum.rs
+++ b/lightning-transaction-sync/src/electrum.rs
@@ -37,20 +37,14 @@ use std::time::Instant;
/// [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
/// [`Watch::watch_channel`]: lightning::chain::Watch::watch_channel
/// [`Filter`]: lightning::chain::Filter
-pub struct ElectrumSyncClient<L: Deref>
-where
- L::Target: Logger,
-{
+pub struct ElectrumSyncClient<L: Logger> {
sync_state: Mutex<SyncState>,
queue: Mutex<FilterQueue>,
client: Arc<ElectrumClient>,
logger: L,
}
-impl<L: Deref> ElectrumSyncClient<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> ElectrumSyncClient<L> {
/// Returns a new [`ElectrumSyncClient`] object.
pub fn new(server_url: String, logger: L) -> Result<Self, TxSyncError> {
let client = Arc::new(ElectrumClient::new(&server_url).map_err(|e| {
@@ -506,10 +500,7 @@ where
}
}
-impl<L: Deref> Filter for ElectrumSyncClient<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> Filter for ElectrumSyncClient<L> {
fn register_tx(&self, txid: &Txid, _script_pubkey: &Script) {
let mut locked_queue = self.queue.lock().unwrap();
locked_queue.transactions.insert(*txid);
diff --git a/lightning-transaction-sync/src/esplora.rs b/lightning-transaction-sync/src/esplora.rs
index a191260..6caf7a6 100644
--- a/lightning-transaction-sync/src/esplora.rs
+++ b/lightning-transaction-sync/src/esplora.rs
@@ -42,20 +42,14 @@ use std::collections::HashSet;
/// [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor
/// [`Watch::watch_channel`]: lightning::chain::Watch::watch_channel
/// [`Filter`]: lightning::chain::Filter
-pub struct EsploraSyncClient<L: Deref>
-where
- L::Target: Logger,
-{
+pub struct EsploraSyncClient<L: Logger> {
sync_state: MutexType<SyncState>,
queue: std::sync::Mutex<FilterQueue>,
client: EsploraClientType,
logger: L,
}
-impl<L: Deref> EsploraSyncClient<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> EsploraSyncClient<L> {
/// Returns a new [`EsploraSyncClient`] object.
pub fn new(server_url: String, logger: L) -> Self {
let builder = Builder::new(&server_url);
@@ -472,10 +466,7 @@ type EsploraClientType = AsyncClient;
#[cfg(not(feature = "async-interface"))]
type EsploraClientType = BlockingClient;
-impl<L: Deref> Filter for EsploraSyncClient<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> Filter for EsploraSyncClient<L> {
fn register_tx(&self, txid: &Txid, _script_pubkey: &Script) {
let mut locked_queue = self.queue.lock().unwrap();
locked_queue.transactions.insert(*txid);
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 30f1d56..87943bd 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -258,14 +258,13 @@ impl<ChannelSigner: EcdsaChannelSigner> Deref for LockedChannelMonitor<'_, Chann
pub struct AsyncPersister<
K: Deref + MaybeSend + MaybeSync + 'static,
S: FutureSpawner,
- L: Deref + MaybeSend + MaybeSync + 'static,
+ L: Logger + MaybeSend + MaybeSync + 'static,
ES: EntropySource + MaybeSend + MaybeSync + 'static,
SP: Deref + MaybeSend + MaybeSync + 'static,
BI: BroadcasterInterface + MaybeSend + MaybeSync + 'static,
FE: FeeEstimator + MaybeSend + MaybeSync + 'static,
> where
K::Target: KVStore + MaybeSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
persister: MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>,
@@ -275,7 +274,7 @@ pub struct AsyncPersister<
impl<
K: Deref + MaybeSend + MaybeSync + 'static,
S: FutureSpawner,
- L: Deref + MaybeSend + MaybeSync + 'static,
+ L: Logger + MaybeSend + MaybeSync + 'static,
ES: EntropySource + MaybeSend + MaybeSync + 'static,
SP: Deref + MaybeSend + MaybeSync + 'static,
BI: BroadcasterInterface + MaybeSend + MaybeSync + 'static,
@@ -283,7 +282,6 @@ impl<
> Deref for AsyncPersister<K, S, L, ES, SP, BI, FE>
where
K::Target: KVStore + MaybeSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
type Target = Self;
@@ -295,7 +293,7 @@ where
impl<
K: Deref + MaybeSend + MaybeSync + 'static,
S: FutureSpawner,
- L: Deref + MaybeSend + MaybeSync + 'static,
+ L: Logger + MaybeSend + MaybeSync + 'static,
ES: EntropySource + MaybeSend + MaybeSync + 'static,
SP: Deref + MaybeSend + MaybeSync + 'static,
BI: BroadcasterInterface + MaybeSend + MaybeSync + 'static,
@@ -303,7 +301,6 @@ impl<
> Persist<<SP::Target as SignerProvider>::EcdsaSigner> for AsyncPersister<K, S, L, ES, SP, BI, FE>
where
K::Target: KVStore + MaybeSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
<SP::Target as SignerProvider>::EcdsaSigner: MaybeSend + 'static,
{
@@ -355,12 +352,11 @@ pub struct ChainMonitor<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
monitors: RwLock<HashMap<ChannelId, MonitorHolder<ChannelSigner>>>,
@@ -394,7 +390,7 @@ impl<
C: Deref,
T: BroadcasterInterface + MaybeSend + MaybeSync + 'static,
F: FeeEstimator + MaybeSend + MaybeSync + 'static,
- L: Deref + MaybeSend + MaybeSync + 'static,
+ L: Logger + MaybeSend + MaybeSync + 'static,
ES: EntropySource + MaybeSend + MaybeSync + 'static,
>
ChainMonitor<
@@ -409,7 +405,6 @@ impl<
K::Target: KVStore + MaybeSync,
SP::Target: SignerProvider + Sized,
C::Target: chain::Filter,
- L::Target: Logger,
<SP::Target as SignerProvider>::EcdsaSigner: MaybeSend + 'static,
{
/// Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
@@ -449,13 +444,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
@@ -1093,13 +1087,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> BaseMessageHandler for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent> {
@@ -1129,13 +1122,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> SendOnlyMessageHandler for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
}
@@ -1145,13 +1137,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> chain::Listen for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) {
@@ -1206,13 +1197,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> chain::Confirm for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData, height: u32) {
@@ -1298,13 +1288,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> chain::Watch<ChannelSigner> for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
fn watch_channel(
@@ -1491,13 +1480,12 @@ impl<
C: Deref,
T: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
P: Deref,
ES: EntropySource,
> events::EventsProvider for ChainMonitor<ChannelSigner, C, T, F, L, P, ES>
where
C::Target: chain::Filter,
- L::Target: Logger,
P::Target: Persist<ChannelSigner>,
{
/// Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index aa862ca..015cae7 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -1828,21 +1828,15 @@ pub(super) use _process_events_body as process_events_body;
pub(crate) struct WithChannelMonitor;
impl WithChannelMonitor {
- pub(crate) fn from<'a, L: Deref, S: EcdsaChannelSigner>(
+ pub(crate) fn from<'a, L: Logger, S: EcdsaChannelSigner>(
logger: &'a L, monitor: &ChannelMonitor<S>, payment_hash: Option<PaymentHash>,
- ) -> WithContext<'a, L>
- where
- L::Target: Logger,
- {
+ ) -> WithContext<'a, L> {
Self::from_impl(logger, &*monitor.inner.lock().unwrap(), payment_hash)
}
- pub(crate) fn from_impl<'a, L: Deref, S: EcdsaChannelSigner>(
+ pub(crate) fn from_impl<'a, L: Logger, S: EcdsaChannelSigner>(
logger: &'a L, monitor_impl: &ChannelMonitorImpl<S>, payment_hash: Option<PaymentHash>,
- ) -> WithContext<'a, L>
- where
- L::Target: Logger,
- {
+ ) -> WithContext<'a, L> {
let peer_id = Some(monitor_impl.counterparty_node_id);
let channel_id = Some(monitor_impl.channel_id());
WithContext::from(logger, peer_id, channel_id, payment_hash)
@@ -2058,16 +2052,14 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
#[rustfmt::skip]
- pub(crate) fn provide_payment_preimage_unsafe_legacy<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub(crate) fn provide_payment_preimage_unsafe_legacy<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self,
payment_hash: &PaymentHash,
payment_preimage: &PaymentPreimage,
broadcaster: &B,
fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, Some(*payment_hash));
// Note that we don't pass any MPP claim parts here. This is generally not okay but in this
@@ -2081,12 +2073,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// itself.
///
/// panics if the given update is not the next update by update_id.
- pub fn update_monitor<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn update_monitor<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self, updates: &ChannelMonitorUpdate, broadcaster: &B, fee_estimator: &F, logger: &L,
- ) -> Result<(), ()>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ()> {
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
inner.update_monitor(updates, broadcaster, fee_estimator, &logger)
@@ -2136,10 +2125,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
/// have been registered.
#[rustfmt::skip]
- pub fn load_outputs_to_watch<F: Deref, L: Deref>(&self, filter: &F, logger: &L)
- where
- F::Target: chain::Filter, L::Target: Logger,
- {
+ pub fn load_outputs_to_watch<F: Deref, L: Logger>(&self, filter: &F, logger: &L)
+ where F::Target: chain::Filter {
let lock = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*lock, None);
for funding in core::iter::once(&lock.funding).chain(&lock.pending_funding) {
@@ -2183,12 +2170,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
/// [`BumpTransaction`]: crate::events::Event::BumpTransaction
- pub fn process_pending_events<H: Deref, L: Deref>(
+ pub fn process_pending_events<H: Deref, L: Logger>(
&self, handler: &H, logger: &L,
) -> Result<(), ReplayEvent>
where
H::Target: EventHandler,
- L::Target: Logger,
{
let mut ev;
process_events_body!(Some(self), logger, ev, handler.handle_event(ev))
@@ -2200,13 +2186,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
pub async fn process_pending_events_async<
Future: core::future::Future<Output = Result<(), ReplayEvent>>,
H: Fn(Event) -> Future,
- L: Deref,
+ L: Logger,
>(
&self, handler: &H, logger: &L,
- ) -> Result<(), ReplayEvent>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ReplayEvent> {
let mut ev;
process_events_body!(Some(self), logger, ev, { handler(ev).await })
}
@@ -2337,12 +2320,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
pub fn broadcast_latest_holder_commitment_txn<
B: BroadcasterInterface,
F: FeeEstimator,
- L: Deref,
+ L: Logger,
>(
&self, broadcaster: &B, fee_estimator: &F, logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
let mut inner = self.inner.lock().unwrap();
let fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
@@ -2359,10 +2340,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// to bypass HolderCommitmentTransaction state update lockdown after signature and generate
/// revoked commitment transaction.
#[cfg(any(test, feature = "_test_utils", feature = "unsafe_revoked_tx_signing"))]
- pub fn unsafe_get_latest_holder_commitment_txn<L: Deref>(&self, logger: &L) -> Vec<Transaction>
- where
- L::Target: Logger,
- {
+ pub fn unsafe_get_latest_holder_commitment_txn<L: Logger>(
+ &self, logger: &L,
+ ) -> Vec<Transaction> {
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
inner.unsafe_get_latest_holder_commitment_txn(&logger)
@@ -2380,7 +2360,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`get_outputs_to_watch`]: #method.get_outputs_to_watch
#[rustfmt::skip]
- pub fn block_connected<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn block_connected<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self,
header: &Header,
txdata: &TransactionData,
@@ -2388,10 +2368,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
broadcaster: B,
fee_estimator: F,
logger: &L,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
inner.block_connected(
@@ -2400,11 +2377,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// Determines if the disconnected block contained any transactions of interest and updates
/// appropriately.
- pub fn blocks_disconnected<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn blocks_disconnected<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self, fork_point: BestBlock, broadcaster: B, fee_estimator: F, logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
inner.blocks_disconnected(fork_point, broadcaster, fee_estimator, &logger)
@@ -2418,7 +2393,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`block_connected`]: Self::block_connected
#[rustfmt::skip]
- pub fn transactions_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn transactions_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self,
header: &Header,
txdata: &TransactionData,
@@ -2426,10 +2401,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
broadcaster: B,
fee_estimator: F,
logger: &L,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
@@ -2444,15 +2416,13 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`blocks_disconnected`]: Self::blocks_disconnected
#[rustfmt::skip]
- pub fn transaction_unconfirmed<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn transaction_unconfirmed<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self,
txid: &Txid,
broadcaster: B,
fee_estimator: F,
logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
@@ -2469,17 +2439,14 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
///
/// [`block_connected`]: Self::block_connected
#[rustfmt::skip]
- pub fn best_block_updated<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn best_block_updated<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self,
header: &Header,
height: u32,
broadcaster: B,
fee_estimator: F,
logger: &L,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let mut inner = self.inner.lock().unwrap();
let logger = WithChannelMonitor::from_impl(logger, &*inner, None);
@@ -2514,12 +2481,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// invoking this every 30 seconds, or lower if running in an environment with spotty
/// connections, like on mobile.
#[rustfmt::skip]
- pub fn rebroadcast_pending_claims<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn rebroadcast_pending_claims<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self, broadcaster: B, fee_estimator: F, logger: &L,
- )
- where
- L::Target: Logger,
- {
+ ) {
let fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let mut lock = self.inner.lock().unwrap();
let inner = &mut *lock;
@@ -2540,12 +2504,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
/// Triggers rebroadcasts of pending claims from a force-closed channel after a transaction
/// signature generation failure.
#[rustfmt::skip]
- pub fn signer_unblocked<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub fn signer_unblocked<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&self, broadcaster: B, fee_estimator: F, logger: &L,
- )
- where
- L::Target: Logger,
- {
+ ) {
let fee_estimator = LowerBoundedFeeEstimator::new(fee_estimator);
let mut lock = self.inner.lock().unwrap();
let inner = &mut *lock;
@@ -3792,11 +3753,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
///
/// Note that this is often called multiple times for the same payment and must be idempotent.
#[rustfmt::skip]
- fn provide_payment_preimage<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn provide_payment_preimage<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self, payment_hash: &PaymentHash, payment_preimage: &PaymentPreimage,
payment_info: &Option<PaymentClaimDetails>, broadcaster: &B,
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &WithContext<L>
- ) where L::Target: Logger {
+ ) {
self.payment_preimages.entry(payment_hash.clone())
.and_modify(|(_, payment_infos)| {
if let Some(payment_info) = payment_info {
@@ -3968,13 +3929,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// See also [`ChannelMonitor::broadcast_latest_holder_commitment_txn`].
///
/// [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]: crate::chain::channelmonitor::ChannelMonitor::broadcast_latest_holder_commitment_txn
- pub(crate) fn queue_latest_holder_commitment_txn_for_broadcast<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ pub(crate) fn queue_latest_holder_commitment_txn_for_broadcast<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self, broadcaster: &B, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &WithContext<L>,
require_funding_seen: bool,
- )
- where
- L::Target: Logger,
- {
+ ) {
let reason = ClosureReason::HolderForceClosed {
broadcasted_latest_txn: Some(true),
message: "ChannelMonitor-initiated commitment transaction broadcast".to_owned(),
@@ -3994,14 +3952,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
);
}
- fn renegotiated_funding<L: Deref>(
+ fn renegotiated_funding<L: Logger>(
&mut self, logger: &WithContext<L>, channel_parameters: &ChannelTransactionParameters,
alternative_holder_commitment_tx: &HolderCommitmentTransaction,
alternative_counterparty_commitment_tx: &CommitmentTransaction,
- ) -> Result<(), ()>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ()> {
let alternative_counterparty_commitment_txid =
alternative_counterparty_commitment_tx.trust().txid();
@@ -4169,11 +4124,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn update_monitor<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn update_monitor<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self, updates: &ChannelMonitorUpdate, broadcaster: &B, fee_estimator: &F, logger: &WithContext<L>
- ) -> Result<(), ()>
- where L::Target: Logger,
- {
+ ) -> Result<(), ()> {
if self.latest_update_id == LEGACY_CLOSED_CHANNEL_UPDATE_ID && updates.update_id == LEGACY_CLOSED_CHANNEL_UPDATE_ID {
log_info!(logger, "Applying pre-0.1 post-force-closed update to monitor {} with {} change(s).",
log_funding_info!(self), updates.updates.len());
@@ -4635,9 +4588,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// Returns packages to claim the revoked output(s) and general information about the output that
/// is to the counterparty in the commitment transaction.
#[rustfmt::skip]
- fn check_spend_counterparty_transaction<L: Deref>(&mut self, commitment_txid: Txid, commitment_tx: &Transaction, height: u32, block_hash: &BlockHash, logger: &L)
+ fn check_spend_counterparty_transaction<L: Logger>(&mut self, commitment_txid: Txid, commitment_tx: &Transaction, height: u32, block_hash: &BlockHash, logger: &L)
-> (Vec<PackageTemplate>, CommitmentTxCounterpartyOutputInfo)
- where L::Target: Logger {
+ {
// Most secp and related errors trying to create keys means we have no hope of constructing
// a spend transaction...so we return no transactions to broadcast
let mut claimable_outpoints = Vec::new();
@@ -4925,9 +4878,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// Attempts to claim a counterparty HTLC-Success/HTLC-Timeout's outputs using the revocation key
#[rustfmt::skip]
- fn check_spend_counterparty_htlc<L: Deref>(
+ fn check_spend_counterparty_htlc<L: Logger>(
&mut self, tx: &Transaction, commitment_number: u64, commitment_txid: &Txid, height: u32, logger: &L
- ) -> (Vec<PackageTemplate>, Option<TransactionOutputs>) where L::Target: Logger {
+ ) -> (Vec<PackageTemplate>, Option<TransactionOutputs>) {
let secret = if let Some(secret) = self.get_secret(commitment_number) { secret } else { return (Vec::new(), None); };
let per_commitment_key = match SecretKey::from_slice(&secret) {
Ok(key) => key,
@@ -5068,13 +5021,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// revoked using data in holder_claimable_outpoints.
/// Should not be used if check_spend_revoked_transaction succeeds.
/// Returns None unless the transaction is definitely one of our commitment transactions.
- fn check_spend_holder_transaction<L: Deref>(
+ fn check_spend_holder_transaction<L: Logger>(
&mut self, commitment_txid: Txid, commitment_tx: &Transaction, height: u32,
block_hash: &BlockHash, logger: &L,
- ) -> Option<(Vec<PackageTemplate>, TransactionOutputs)>
- where
- L::Target: Logger,
- {
+ ) -> Option<(Vec<PackageTemplate>, TransactionOutputs)> {
let funding_spent = get_confirmed_funding_scope!(self);
// HTLCs set may differ between last and previous holder commitment txn, in case of one them hitting chain, ensure we cancel all HTLCs backward
@@ -5137,9 +5087,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// Cancels any existing pending claims for a commitment that previously confirmed and has now
/// been replaced by another.
#[rustfmt::skip]
- pub fn cancel_prev_commitment_claims<L: Deref>(
+ pub fn cancel_prev_commitment_claims<L: Logger>(
&mut self, logger: &L, confirmed_commitment_txid: &Txid
- ) where L::Target: Logger {
+ ) {
for (counterparty_commitment_txid, _) in &self.counterparty_commitment_txn_on_chain {
// Cancel any pending claims for counterparty commitments we've seen confirm.
if counterparty_commitment_txid == confirmed_commitment_txid {
@@ -5211,9 +5161,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
#[cfg(any(test, feature = "_test_utils", feature = "unsafe_revoked_tx_signing"))]
/// Note that this includes possibly-locktimed-in-the-future transactions!
#[rustfmt::skip]
- fn unsafe_get_latest_holder_commitment_txn<L: Deref>(
+ fn unsafe_get_latest_holder_commitment_txn<L: Logger>(
&mut self, logger: &WithContext<L>
- ) -> Vec<Transaction> where L::Target: Logger {
+ ) -> Vec<Transaction> {
log_debug!(logger, "Getting signed copy of latest holder commitment transaction!");
let commitment_tx = {
let sig = self.onchain_tx_handler.signer.unsafe_sign_holder_commitment(
@@ -5263,10 +5213,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn block_connected<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn block_connected<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self, header: &Header, txdata: &TransactionData, height: u32, broadcaster: B,
fee_estimator: F, logger: &WithContext<L>,
- ) -> Vec<TransactionOutputs> where L::Target: Logger, {
+ ) -> Vec<TransactionOutputs> {
let block_hash = header.block_hash();
self.best_block = BestBlock::new(block_hash, height);
@@ -5275,17 +5225,14 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn best_block_updated<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn best_block_updated<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self,
header: &Header,
height: u32,
broadcaster: B,
fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &WithContext<L>,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
let block_hash = header.block_hash();
if height > self.best_block.height {
@@ -5305,7 +5252,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn transactions_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn transactions_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self,
header: &Header,
txdata: &TransactionData,
@@ -5313,10 +5260,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
broadcaster: B,
fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &WithContext<L>,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
let funding_seen_before = self.funding_seen_onchain;
let txn_matched = self.filter_block(txdata);
@@ -5588,7 +5532,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// `conf_height` should be set to the height at which any new transaction(s)/block(s) were
/// confirmed at, even if it is not the current best height.
#[rustfmt::skip]
- fn block_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn block_confirmed<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self,
conf_height: u32,
conf_hash: BlockHash,
@@ -5598,10 +5542,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
broadcaster: &B,
fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &WithContext<L>,
- ) -> Vec<TransactionOutputs>
- where
- L::Target: Logger,
- {
+ ) -> Vec<TransactionOutputs> {
log_trace!(logger, "Processing {} matched transactions for block at height {}.", txn_matched.len(), conf_height);
debug_assert!(self.best_block.height >= conf_height);
@@ -5814,10 +5755,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn blocks_disconnected<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn blocks_disconnected<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self, fork_point: BestBlock, broadcaster: B, fee_estimator: F, logger: &WithContext<L>
- ) where L::Target: Logger,
- {
+ ) {
let new_height = fork_point.height;
log_trace!(logger, "Block(s) disconnected to height {}", new_height);
assert!(self.best_block.height > fork_point.height,
@@ -5861,15 +5801,13 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn transaction_unconfirmed<B: BroadcasterInterface, F: FeeEstimator, L: Deref>(
+ fn transaction_unconfirmed<B: BroadcasterInterface, F: FeeEstimator, L: Logger>(
&mut self,
txid: &Txid,
broadcaster: B,
fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &WithContext<L>,
- ) where
- L::Target: Logger,
- {
+ ) {
let mut removed_height = None;
for entry in self.onchain_events_awaiting_threshold_conf.iter() {
if entry.txid == *txid {
@@ -5974,9 +5912,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
#[rustfmt::skip]
- fn should_broadcast_holder_commitment_txn<L: Deref>(
+ fn should_broadcast_holder_commitment_txn<L: Logger>(
&self, logger: &WithContext<L>
- ) -> Option<PaymentHash> where L::Target: Logger {
+ ) -> Option<PaymentHash> {
// There's no need to broadcast our commitment transaction if we've seen one confirmed (even
// with 1 confirmation) as it'll be rejected as duplicate/conflicting.
if self.funding_spend_confirmed.is_some() ||
@@ -6041,9 +5979,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// Check if any transaction broadcasted is resolving HTLC output by a success or timeout on a holder
/// or counterparty commitment tx, if so send back the source, preimage if found and payment_hash of resolved HTLC
#[rustfmt::skip]
- fn is_resolving_htlc_output<L: Deref>(
+ fn is_resolving_htlc_output<L: Logger>(
&mut self, tx: &Transaction, height: u32, block_hash: &BlockHash, logger: &WithContext<L>,
- ) where L::Target: Logger {
+ ) {
let funding_spent = get_confirmed_funding_scope!(self);
'outer_loop: for input in &tx.input {
@@ -6298,9 +6236,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
/// Checks if the confirmed transaction is paying funds back to some address we can assume to
/// own.
#[rustfmt::skip]
- fn check_tx_and_push_spendable_outputs<L: Deref>(
+ fn check_tx_and_push_spendable_outputs<L: Logger>(
&mut self, tx: &Transaction, height: u32, block_hash: &BlockHash, logger: &WithContext<L>,
- ) where L::Target: Logger {
+ ) {
let funding_spent = get_confirmed_funding_scope!(self);
for spendable_output in self.get_spendable_outputs(funding_spent, tx) {
let entry = OnchainEventEntry {
@@ -6320,10 +6258,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
}
-impl<Signer: EcdsaChannelSigner, T: BroadcasterInterface, F: FeeEstimator, L: Deref> chain::Listen
+impl<Signer: EcdsaChannelSigner, T: BroadcasterInterface, F: FeeEstimator, L: Logger> chain::Listen
for (ChannelMonitor<Signer>, T, F, L)
-where
- L::Target: Logger,
{
fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) {
self.0.block_connected(header, txdata, height, &self.1, &self.2, &self.3);
@@ -6334,11 +6270,10 @@ where
}
}
-impl<Signer: EcdsaChannelSigner, M, T: BroadcasterInterface, F: FeeEstimator, L: Deref>
+impl<Signer: EcdsaChannelSigner, M, T: BroadcasterInterface, F: FeeEstimator, L: Logger>
chain::Confirm for (M, T, F, L)
where
M: Deref<Target = ChannelMonitor<Signer>>,
- L::Target: Logger,
{
fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData, height: u32) {
self.0.transactions_confirmed(header, txdata, height, &self.1, &self.2, &self.3);
diff --git a/lightning/src/events/bump_transaction/mod.rs b/lightning/src/events/bump_transaction/mod.rs
index b45b659..bc91212 100644
--- a/lightning/src/events/bump_transaction/mod.rs
+++ b/lightning/src/events/bump_transaction/mod.rs
@@ -442,10 +442,9 @@ pub trait WalletSource {
///
/// This is not exported to bindings users as async is only supported in Rust.
// Note that updates to documentation on this struct should be copied to the synchronous version.
-pub struct Wallet<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend>
+pub struct Wallet<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend>
where
W::Target: WalletSource + MaybeSend,
- L::Target: Logger + MaybeSend,
{
source: W,
logger: L,
@@ -455,10 +454,9 @@ where
locked_utxos: Mutex<HashMap<OutPoint, ClaimId>>,
}
-impl<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend> Wallet<W, L>
+impl<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend> Wallet<W, L>
where
W::Target: WalletSource + MaybeSend,
- L::Target: Logger + MaybeSend,
{
/// Returns a new instance backed by the given [`WalletSource`] that serves as an implementation
/// of [`CoinSelectionSource`].
@@ -617,11 +615,10 @@ where
}
}
-impl<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend> CoinSelectionSource
+impl<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend> CoinSelectionSource
for Wallet<W, L>
where
W::Target: WalletSource + MaybeSend + MaybeSync,
- L::Target: Logger + MaybeSend + MaybeSync,
{
fn select_confirmed_utxos<'a>(
&'a self, claim_id: ClaimId, must_spend: Vec<Input>, must_pay_to: &'a [TxOut],
@@ -694,11 +691,10 @@ where
///
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
// Note that updates to documentation on this struct should be copied to the synchronous version.
-pub struct BumpTransactionEventHandler<B: BroadcasterInterface, C: Deref, SP: Deref, L: Deref>
+pub struct BumpTransactionEventHandler<B: BroadcasterInterface, C: Deref, SP: Deref, L: Logger>
where
C::Target: CoinSelectionSource,
SP::Target: SignerProvider,
- L::Target: Logger,
{
broadcaster: B,
utxo_source: C,
@@ -707,12 +703,11 @@ where
secp: Secp256k1<secp256k1::All>,
}
-impl<B: BroadcasterInterface, C: Deref, SP: Deref, L: Deref>
+impl<B: BroadcasterInterface, C: Deref, SP: Deref, L: Logger>
BumpTransactionEventHandler<B, C, SP, L>
where
C::Target: CoinSelectionSource,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Returns a new instance capable of handling [`Event::BumpTransaction`] events.
///
diff --git a/lightning/src/events/bump_transaction/sync.rs b/lightning/src/events/bump_transaction/sync.rs
index bf0668c..e19ab3d 100644
--- a/lightning/src/events/bump_transaction/sync.rs
+++ b/lightning/src/events/bump_transaction/sync.rs
@@ -100,18 +100,16 @@ where
///
/// For an asynchronous version of this wrapper, see [`Wallet`].
// Note that updates to documentation on this struct should be copied to the asynchronous version.
-pub struct WalletSync<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend>
+pub struct WalletSync<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend>
where
W::Target: WalletSourceSync + MaybeSend,
- L::Target: Logger + MaybeSend,
{
wallet: Wallet<WalletSourceSyncWrapper<W>, L>,
}
-impl<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend> WalletSync<W, L>
+impl<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend> WalletSync<W, L>
where
W::Target: WalletSourceSync + MaybeSend,
- L::Target: Logger + MaybeSend,
{
/// Constructs a new [`WalletSync`] instance.
pub fn new(source: W, logger: L) -> Self {
@@ -119,11 +117,10 @@ where
}
}
-impl<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend> CoinSelectionSourceSync
+impl<W: Deref + MaybeSync + MaybeSend, L: Logger + MaybeSync + MaybeSend> CoinSelectionSourceSync
for WalletSync<W, L>
where
W::Target: WalletSourceSync + MaybeSend + MaybeSync,
- L::Target: Logger + MaybeSend + MaybeSync,
{
fn select_confirmed_utxos(
&self, claim_id: ClaimId, must_spend: Vec<Input>, must_pay_to: &[TxOut],
@@ -267,22 +264,20 @@ where
///
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
// Note that updates to documentation on this struct should be copied to the synchronous version.
-pub struct BumpTransactionEventHandlerSync<B: BroadcasterInterface, C: Deref, SP: Deref, L: Deref>
+pub struct BumpTransactionEventHandlerSync<B: BroadcasterInterface, C: Deref, SP: Deref, L: Logger>
where
C::Target: CoinSelectionSourceSync,
SP::Target: SignerProvider,
- L::Target: Logger,
{
bump_transaction_event_handler:
BumpTransactionEventHandler<B, CoinSelectionSourceSyncWrapper<C>, SP, L>,
}
-impl<B: BroadcasterInterface, C: Deref, SP: Deref, L: Deref>
+impl<B: BroadcasterInterface, C: Deref, SP: Deref, L: Logger>
BumpTransactionEventHandlerSync<B, C, SP, L>
where
C::Target: CoinSelectionSourceSync,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Constructs a new instance of [`BumpTransactionEventHandlerSync`].
pub fn new(broadcaster: B, utxo_source: C, signer_provider: SP, logger: L) -> Self {
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 56317e7..fc20708 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -985,20 +985,14 @@ impl ChannelError {
}
}
-pub(super) struct WithChannelContext<'a, L: Deref>
-where
- L::Target: Logger,
-{
+pub(super) struct WithChannelContext<'a, L: Logger> {
pub logger: &'a L,
pub peer_id: Option<PublicKey>,
pub channel_id: Option<ChannelId>,
pub payment_hash: Option<PaymentHash>,
}
-impl<'a, L: Deref> Logger for WithChannelContext<'a, L>
-where
- L::Target: Logger,
-{
+impl<'a, L: Logger> Logger for WithChannelContext<'a, L> {
fn log(&self, mut record: Record) {
record.peer_id = self.peer_id;
record.channel_id = self.channel_id;
@@ -1007,10 +1001,7 @@ where
}
}
-impl<'a, 'b, L: Deref> WithChannelContext<'a, L>
-where
- L::Target: Logger,
-{
+impl<'a, 'b, L: Logger> WithChannelContext<'a, L> {
pub(super) fn from<S: Deref>(
logger: &'a L, context: &'b ChannelContext<S>, payment_hash: Option<PaymentHash>,
) -> Self
@@ -1294,11 +1285,10 @@ impl HolderCommitmentPoint {
/// If we are pending advancing the next commitment point, this method tries asking the signer
/// again.
- pub fn try_resolve_pending<SP: Deref, L: Deref>(
+ pub fn try_resolve_pending<SP: Deref, L: Logger>(
&mut self, signer: &ChannelSignerType<SP>, secp_ctx: &Secp256k1<secp256k1::All>, logger: &L,
) where
SP::Target: SignerProvider,
- L::Target: Logger,
{
if !self.can_advance() {
let pending_next_point = signer
@@ -1331,12 +1321,11 @@ impl HolderCommitmentPoint {
///
/// If our signer is ready to provide the next commitment point, the next call to `advance` will
/// succeed.
- pub fn advance<SP: Deref, L: Deref>(
+ pub fn advance<SP: Deref, L: Logger>(
&mut self, signer: &ChannelSignerType<SP>, secp_ctx: &Secp256k1<secp256k1::All>, logger: &L,
) -> Result<(), ()>
where
SP::Target: SignerProvider,
- L::Target: Logger,
{
if let Some(next_point) = self.pending_next_point {
*self = Self {
@@ -1619,9 +1608,9 @@ where
}
#[rustfmt::skip]
- pub fn signer_maybe_unblocked<L: Deref, CBP>(
+ pub fn signer_maybe_unblocked<L: Logger, CBP>(
&mut self, chain_hash: ChainHash, logger: &L, path_for_release_htlc: CBP
- ) -> Result<Option<SignerResumeUpdates>, ChannelError> where L::Target: Logger, CBP: Fn(u64) -> BlindedMessagePath {
+ ) -> Result<Option<SignerResumeUpdates>, ChannelError> where CBP: Fn(u64) -> BlindedMessagePath {
match &mut self.phase {
ChannelPhase::Undefined => unreachable!(),
ChannelPhase::Funded(chan) => chan.signer_maybe_unblocked(logger, path_for_release_htlc).map(|r| Some(r)),
@@ -1664,10 +1653,7 @@ where
/// Should be called when the peer is disconnected. Returns true if the channel can be resumed
/// when the peer reconnects (via [`Self::peer_connected_get_handshake`]). If not, the channel
/// must be immediately closed.
- pub fn peer_disconnected_is_resumable<L: Deref>(&mut self, logger: &L) -> DisconnectResult
- where
- L::Target: Logger,
- {
+ pub fn peer_disconnected_is_resumable<L: Logger>(&mut self, logger: &L) -> DisconnectResult {
let is_resumable = match &mut self.phase {
ChannelPhase::Undefined => unreachable!(),
ChannelPhase::Funded(chan) => {
@@ -1721,9 +1707,9 @@ where
/// Should be called when the peer re-connects, returning an initial message which we should
/// send our peer to begin the channel reconnection process.
#[rustfmt::skip]
- pub fn peer_connected_get_handshake<L: Deref>(
+ pub fn peer_connected_get_handshake<L: Logger>(
&mut self, chain_hash: ChainHash, logger: &L,
- ) -> ReconnectionMsg where L::Target: Logger {
+ ) -> ReconnectionMsg {
match &mut self.phase {
ChannelPhase::Undefined => unreachable!(),
ChannelPhase::Funded(chan) =>
@@ -1757,13 +1743,10 @@ where
}
#[rustfmt::skip]
- pub fn maybe_handle_error_without_close<F: FeeEstimator, L: Deref>(
+ pub fn maybe_handle_error_without_close<F: FeeEstimator, L: Logger>(
&mut self, chain_hash: ChainHash, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
user_config: &UserConfig, their_features: &InitFeatures,
- ) -> Result<Option<OpenChannelMessage>, ()>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<OpenChannelMessage>, ()> {
match &mut self.phase {
ChannelPhase::Undefined => unreachable!(),
ChannelPhase::Funded(_) => Ok(None),
@@ -1796,12 +1779,9 @@ where
}
}
- fn fail_interactive_tx_negotiation<L: Deref>(
+ fn fail_interactive_tx_negotiation<L: Logger>(
&mut self, reason: AbortReason, logger: &L,
- ) -> (ChannelError, Option<SpliceFundingFailed>)
- where
- L::Target: Logger,
- {
+ ) -> (ChannelError, Option<SpliceFundingFailed>) {
let logger = WithChannelContext::from(logger, &self.context(), None);
log_info!(logger, "Failed interactive transaction negotiation: {reason}");
@@ -1825,12 +1805,9 @@ where
(ChannelError::Abort(reason), splice_funding_failed)
}
- pub fn tx_add_input<L: Deref>(
+ pub fn tx_add_input<L: Logger>(
&mut self, msg: &msgs::TxAddInput, logger: &L,
- ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)>
- where
- L::Target: Logger,
- {
+ ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)> {
match self.interactive_tx_constructor_mut() {
Some(interactive_tx_constructor) => interactive_tx_constructor
.handle_tx_add_input(msg)
@@ -1844,12 +1821,9 @@ where
}
}
- pub fn tx_add_output<L: Deref>(
+ pub fn tx_add_output<L: Logger>(
&mut self, msg: &msgs::TxAddOutput, logger: &L,
- ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)>
- where
- L::Target: Logger,
- {
+ ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)> {
match self.interactive_tx_constructor_mut() {
Some(interactive_tx_constructor) => interactive_tx_constructor
.handle_tx_add_output(msg)
@@ -1863,12 +1837,9 @@ where
}
}
- pub fn tx_remove_input<L: Deref>(
+ pub fn tx_remove_input<L: Logger>(
&mut self, msg: &msgs::TxRemoveInput, logger: &L,
- ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)>
- where
- L::Target: Logger,
- {
+ ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)> {
match self.interactive_tx_constructor_mut() {
Some(interactive_tx_constructor) => interactive_tx_constructor
.handle_tx_remove_input(msg)
@@ -1882,12 +1853,9 @@ where
}
}
- pub fn tx_remove_output<L: Deref>(
+ pub fn tx_remove_output<L: Logger>(
&mut self, msg: &msgs::TxRemoveOutput, logger: &L,
- ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)>
- where
- L::Target: Logger,
- {
+ ) -> Result<InteractiveTxMessageSend, (ChannelError, Option<SpliceFundingFailed>)> {
match self.interactive_tx_constructor_mut() {
Some(interactive_tx_constructor) => interactive_tx_constructor
.handle_tx_remove_output(msg)
@@ -1901,12 +1869,9 @@ where
}
}
- pub fn tx_complete<F: FeeEstimator, L: Deref>(
+ pub fn tx_complete<F: FeeEstimator, L: Logger>(
&mut self, msg: &msgs::TxComplete, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> Result<TxCompleteResult, (ChannelError, Option<SpliceFundingFailed>)>
- where
- L::Target: Logger,
- {
+ ) -> Result<TxCompleteResult, (ChannelError, Option<SpliceFundingFailed>)> {
let tx_complete_action = match self.interactive_tx_constructor_mut() {
Some(interactive_tx_constructor) => interactive_tx_constructor
.handle_tx_complete(msg)
@@ -1971,12 +1936,9 @@ where
Ok(TxCompleteResult { interactive_tx_msg_send, event_unsigned_tx, funding_tx_signed })
}
- pub fn tx_abort<L: Deref>(
+ pub fn tx_abort<L: Logger>(
&mut self, msg: &msgs::TxAbort, logger: &L,
- ) -> Result<(Option<msgs::TxAbort>, Option<SpliceFundingFailed>), ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<(Option<msgs::TxAbort>, Option<SpliceFundingFailed>), ChannelError> {
// If we have not sent a `tx_abort` message for this negotiation previously, we need to echo
// back a tx_abort message according to the spec:
// https://github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L560-L561
@@ -2043,12 +2005,9 @@ where
}
#[rustfmt::skip]
- pub fn funding_signed<L: Deref>(
+ pub fn funding_signed<L: Logger>(
&mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP, logger: &L
- ) -> Result<(&mut FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), ChannelError>
- where
- L::Target: Logger
- {
+ ) -> Result<(&mut FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), ChannelError> {
let phase = core::mem::replace(&mut self.phase, ChannelPhase::Undefined);
let result = if let ChannelPhase::UnfundedOutboundV1(chan) = phase {
let channel_state = chan.context.channel_state;
@@ -2142,13 +2101,10 @@ where
Ok(())
}
- pub fn funding_transaction_signed<F: FeeEstimator, L: Deref>(
+ pub fn funding_transaction_signed<F: FeeEstimator, L: Logger>(
&mut self, funding_txid_signed: Txid, witnesses: Vec<Witness>, best_block_height: u32,
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> Result<FundingTxSigned, APIError>
- where
- L::Target: Logger,
- {
+ ) -> Result<FundingTxSigned, APIError> {
let (context, funding, pending_splice) = match &mut self.phase {
ChannelPhase::Undefined => unreachable!(),
ChannelPhase::UnfundedV2(channel) => (&mut channel.context, &channel.funding, None),
@@ -2319,12 +2275,9 @@ where
}
#[rustfmt::skip]
- pub fn commitment_signed<F: FeeEstimator, L: Deref>(
+ pub fn commitment_signed<F: FeeEstimator, L: Logger>(
&mut self, msg: &msgs::CommitmentSigned, best_block: BestBlock, signer_provider: &SP, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
- ) -> Result<(Option<ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>>, Option<ChannelMonitorUpdate>), ChannelError>
- where
- L::Target: Logger
- {
+ ) -> Result<(Option<ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>>, Option<ChannelMonitorUpdate>), ChannelError> {
let phase = core::mem::replace(&mut self.phase, ChannelPhase::Undefined);
match phase {
ChannelPhase::UnfundedV2(chan) => {
@@ -3342,9 +3295,9 @@ where
fn received_msg(&self) -> &'static str;
#[rustfmt::skip]
- fn check_counterparty_commitment_signature<L: Deref>(
+ fn check_counterparty_commitment_signature<L: Logger>(
&self, sig: &Signature, holder_commitment_point: &HolderCommitmentPoint, logger: &L
- ) -> Result<CommitmentTransaction, ChannelError> where L::Target: Logger {
+ ) -> Result<CommitmentTransaction, ChannelError> {
let funding_script = self.funding().get_funding_redeemscript();
let commitment_data = self.context().build_commitment_transaction(self.funding(),
@@ -3365,13 +3318,10 @@ where
}
#[rustfmt::skip]
- fn initial_commitment_signed<L: Deref>(
+ fn initial_commitment_signed<L: Logger>(
&mut self, channel_id: ChannelId, counterparty_signature: Signature, holder_commitment_point: &mut HolderCommitmentPoint,
best_block: BestBlock, signer_provider: &SP, logger: &L,
- ) -> Result<(ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>, CommitmentTransaction), ChannelError>
- where
- L::Target: Logger
- {
+ ) -> Result<(ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>, CommitmentTransaction), ChannelError> {
let initial_commitment_tx = match self.check_counterparty_commitment_signature(&counterparty_signature, holder_commitment_point, logger) {
Ok(res) => res,
Err(ChannelError::Close(e)) => {
@@ -3560,7 +3510,7 @@ where
SP::Target: SignerProvider,
{
#[rustfmt::skip]
- fn new_for_inbound_channel<'a, ES: EntropySource, F: FeeEstimator, L: Deref>(
+ fn new_for_inbound_channel<'a, ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &'a LowerBoundedFeeEstimator<F>,
entropy_source: &'a ES,
signer_provider: &'a SP,
@@ -3580,7 +3530,6 @@ where
open_channel_fields: msgs::CommonOpenChannelFields,
) -> Result<(FundingScope, ChannelContext<SP>), ChannelError>
where
- L::Target: Logger,
SP::Target: SignerProvider,
{
let logger = WithContext::from(logger, Some(counterparty_node_id), Some(open_channel_fields.temporary_channel_id), None);
@@ -3903,7 +3852,7 @@ where
}
#[rustfmt::skip]
- fn new_for_outbound_channel<'a, ES: EntropySource, F: FeeEstimator, L: Deref>(
+ fn new_for_outbound_channel<'a, ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &'a LowerBoundedFeeEstimator<F>,
entropy_source: &'a ES,
signer_provider: &'a SP,
@@ -3923,7 +3872,6 @@ where
) -> Result<(FundingScope, ChannelContext<SP>), APIError>
where
SP::Target: SignerProvider,
- L::Target: Logger,
{
// This will be updated with the counterparty contribution if this is a dual-funded channel
let channel_value_satoshis = funding_satoshis;
@@ -5121,16 +5069,13 @@ where
Ok(())
}
- fn validate_commitment_signed<F: FeeEstimator, L: Deref>(
+ fn validate_commitment_signed<F: FeeEstimator, L: Logger>(
&self, funding: &FundingScope, transaction_number: u64, commitment_point: PublicKey,
msg: &msgs::CommitmentSigned, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
) -> Result<
(HolderCommitmentTransaction, Vec<(HTLCOutputInCommitment, Option<&HTLCSource>)>),
ChannelError,
- >
- where
- L::Target: Logger,
- {
+ > {
let funding_script = funding.get_funding_redeemscript();
let commitment_data = self.build_commitment_transaction(
@@ -5252,13 +5197,10 @@ where
Ok((holder_commitment_tx, commitment_data.htlcs_included))
}
- fn can_send_update_fee<F: FeeEstimator, L: Deref>(
+ fn can_send_update_fee<F: FeeEstimator, L: Logger>(
&self, funding: &FundingScope, feerate_per_kw: u32,
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> bool
- where
- L::Target: Logger,
- {
+ ) -> bool {
// Before proposing a feerate update, check that we can actually afford the new fee.
let dust_exposure_limiting_feerate =
self.get_dust_exposure_limiting_feerate(&fee_estimator, funding.get_channel_type());
@@ -5333,12 +5275,9 @@ where
return true;
}
- fn can_accept_incoming_htlc<L: Deref>(
+ fn can_accept_incoming_htlc<L: Logger>(
&self, funding: &FundingScope, dust_exposure_limiting_feerate: Option<u32>, logger: &L,
- ) -> Result<(), LocalHTLCFailureReason>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), LocalHTLCFailureReason> {
// The fee spike buffer (an additional nondust HTLC) we keep for the remote if the channel
// is not zero fee. This deviates from the spec because the fee spike buffer requirement
// doesn't exist on the receiver's side, only on the sender's.
@@ -5464,9 +5403,7 @@ where
/// which peer generated this transaction and "to whom" this transaction flows.
#[inline]
#[rustfmt::skip]
- fn build_commitment_transaction<L: Deref>(&self, funding: &FundingScope, commitment_number: u64, per_commitment_point: &PublicKey, local: bool, generated_by_local: bool, logger: &L) -> CommitmentData<'_>
- where L::Target: Logger
- {
+ fn build_commitment_transaction<L: Logger>(&self, funding: &FundingScope, commitment_number: u64, per_commitment_point: &PublicKey, local: bool, generated_by_local: bool, logger: &L) -> CommitmentData<'_> {
let broadcaster_dust_limit_sat = if local { self.holder_dust_limit_satoshis } else { self.counterparty_dust_limit_satoshis };
let feerate_per_kw = self.get_commitment_feerate(funding, generated_by_local);
@@ -6319,10 +6256,10 @@ where
/// Only allowed after [`FundingScope::channel_transaction_parameters`] is set.
#[rustfmt::skip]
- fn get_funding_signed_msg<L: Deref>(
+ fn get_funding_signed_msg<L: Logger>(
&mut self, channel_parameters: &ChannelTransactionParameters, logger: &L,
counterparty_initial_commitment_tx: CommitmentTransaction,
- ) -> Option<msgs::FundingSigned> where L::Target: Logger {
+ ) -> Option<msgs::FundingSigned> {
let counterparty_trusted_tx = counterparty_initial_commitment_tx.trust();
let counterparty_initial_bitcoin_tx = counterparty_trusted_tx.built_transaction();
log_trace!(logger, "Initial counterparty tx for channel {} is: txid {} tx {}",
@@ -6424,12 +6361,11 @@ where
}
}
- fn get_initial_counterparty_commitment_signatures<L: Deref>(
+ fn get_initial_counterparty_commitment_signatures<L: Logger>(
&self, funding: &FundingScope, logger: &L,
) -> Option<(Signature, Vec<Signature>)>
where
SP::Target: SignerProvider,
- L::Target: Logger,
{
let mut commitment_number = self.counterparty_next_commitment_transaction_number;
let mut commitment_point = self.counterparty_next_commitment_point.unwrap();
@@ -6469,12 +6405,11 @@ where
}
}
- fn get_initial_commitment_signed_v2<L: Deref>(
+ fn get_initial_commitment_signed_v2<L: Logger>(
&self, funding: &FundingScope, logger: &L,
) -> Option<msgs::CommitmentSigned>
where
SP::Target: SignerProvider,
- L::Target: Logger,
{
let signatures = self.get_initial_counterparty_commitment_signatures(funding, logger);
if let Some((signature, htlc_signatures)) = signatures {
@@ -6521,13 +6456,10 @@ where
}
#[rustfmt::skip]
- fn check_for_funding_tx_confirmed<L: Deref>(
+ fn check_for_funding_tx_confirmed<L: Logger>(
&mut self, funding: &mut FundingScope, block_hash: &BlockHash, height: u32,
index_in_block: usize, tx: &mut ConfirmedTransaction, logger: &L,
- ) -> Result<bool, ClosureReason>
- where
- L::Target: Logger,
- {
+ ) -> Result<bool, ClosureReason> {
let funding_txo = match funding.get_funding_txo() {
Some(funding_txo) => funding_txo,
None => {
@@ -7306,10 +7238,10 @@ where
}
#[rustfmt::skip]
- fn check_remote_fee<F: FeeEstimator, L: Deref>(
+ fn check_remote_fee<F: FeeEstimator, L: Logger>(
channel_type: &ChannelTypeFeatures, fee_estimator: &LowerBoundedFeeEstimator<F>,
feerate_per_kw: u32, cur_feerate_per_kw: Option<u32>, logger: &L
- ) -> Result<(), ChannelError> where L::Target: Logger {
+ ) -> Result<(), ChannelError> {
if channel_type.supports_anchor_zero_fee_commitments() {
if feerate_per_kw != 0 {
let err = "Zero Fee Channels must never attempt to use a fee".to_owned();
@@ -7459,11 +7391,9 @@ where
///
/// The HTLC claim will end up in the holding cell (because the caller must ensure the peer is
/// disconnected).
- pub fn claim_htlc_while_disconnected_dropping_mon_update_legacy<L: Deref>(
+ pub fn claim_htlc_while_disconnected_dropping_mon_update_legacy<L: Logger>(
&mut self, htlc_id_arg: u64, payment_preimage_arg: PaymentPreimage, logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
// Assert that we'll add the HTLC claim to the holding cell in `get_update_fulfill_htlc`
// (see equivalent if condition there).
assert!(!self.context.channel_state.can_generate_new_commitment());
@@ -7476,14 +7406,11 @@ where
}
}
- fn get_update_fulfill_htlc<L: Deref>(
+ fn get_update_fulfill_htlc<L: Logger>(
&mut self, htlc_id_arg: u64, payment_preimage_arg: PaymentPreimage,
payment_info: Option<PaymentClaimDetails>, attribution_data: Option<AttributionData>,
logger: &L,
- ) -> UpdateFulfillFetch
- where
- L::Target: Logger,
- {
+ ) -> UpdateFulfillFetch {
// Either ChannelReady got set (which means it won't be unset) or there is no way any
// caller thought we could have something claimed (cause we wouldn't have accepted in an
// incoming HTLC anyway). If we got to ShutdownComplete, callers aren't allowed to call us,
@@ -7630,14 +7557,11 @@ where
UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, update_blocked: false }
}
- pub fn get_update_fulfill_htlc_and_commit<L: Deref>(
+ pub fn get_update_fulfill_htlc_and_commit<L: Logger>(
&mut self, htlc_id: u64, payment_preimage: PaymentPreimage,
payment_info: Option<PaymentClaimDetails>, attribution_data: Option<AttributionData>,
logger: &L,
- ) -> UpdateFulfillCommitFetch
- where
- L::Target: Logger,
- {
+ ) -> UpdateFulfillCommitFetch {
let release_cs_monitor = self.context.blocked_monitor_updates.is_empty();
match self.get_update_fulfill_htlc(
htlc_id,
@@ -7697,12 +7621,9 @@ where
/// Returns `Err` (always with [`ChannelError::Ignore`]) if the HTLC could not be failed (e.g.
/// if it was already resolved). Otherwise returns `Ok`.
- pub fn queue_fail_htlc<L: Deref>(
+ pub fn queue_fail_htlc<L: Logger>(
&mut self, htlc_id_arg: u64, err_packet: msgs::OnionErrorPacket, logger: &L,
- ) -> Result<(), ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ChannelError> {
self.fail_htlc(htlc_id_arg, err_packet, true, logger)
.map(|msg_opt| assert!(msg_opt.is_none(), "We forced holding cell?"))
}
@@ -7711,12 +7632,9 @@ where
/// want to fail blinded HTLCs where we are not the intro node.
///
/// See [`Self::queue_fail_htlc`] for more info.
- pub fn queue_fail_malformed_htlc<L: Deref>(
+ pub fn queue_fail_malformed_htlc<L: Logger>(
&mut self, htlc_id_arg: u64, failure_code: u16, sha256_of_onion: [u8; 32], logger: &L,
- ) -> Result<(), ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ChannelError> {
self.fail_htlc(htlc_id_arg, (sha256_of_onion, failure_code), true, logger)
.map(|msg_opt| assert!(msg_opt.is_none(), "We forced holding cell?"))
}
@@ -7724,10 +7642,10 @@ where
/// Returns `Err` (always with [`ChannelError::Ignore`]) if the HTLC could not be failed (e.g.
/// if it was already resolved). Otherwise returns `Ok`.
#[rustfmt::skip]
- fn fail_htlc<L: Deref, E: FailHTLCContents + Clone>(
+ fn fail_htlc<L: Logger, E: FailHTLCContents + Clone>(
&mut self, htlc_id_arg: u64, err_contents: E, mut force_holding_cell: bool,
logger: &L
- ) -> Result<Option<E::Message>, ChannelError> where L::Target: Logger {
+ ) -> Result<Option<E::Message>, ChannelError> {
if !matches!(self.context.channel_state, ChannelState::ChannelReady(_)) {
panic!("Was asked to fail an HTLC when channel was not in an operational state");
}
@@ -7834,13 +7752,10 @@ where
/// and the channel is now usable (and public), this may generate an announcement_signatures to
/// reply with.
#[rustfmt::skip]
- pub fn channel_ready<NS: NodeSigner, L: Deref>(
+ pub fn channel_ready<NS: NodeSigner, L: Logger>(
&mut self, msg: &msgs::ChannelReady, node_signer: &NS, chain_hash: ChainHash,
user_config: &UserConfig, best_block: &BestBlock, logger: &L
- ) -> Result<Option<msgs::AnnouncementSignatures>, ChannelError>
- where
- L::Target: Logger
- {
+ ) -> Result<Option<msgs::AnnouncementSignatures>, ChannelError> {
if self.context.channel_state.is_peer_disconnected() {
self.context.workaround_lnd_bug_4006 = Some(msg.clone());
return Err(ChannelError::Ignore("Peer sent channel_ready when we needed a channel_reestablish. The peer is likely lnd, see https://github.com/lightningnetwork/lnd/issues/4006".to_owned()));
@@ -8069,13 +7984,10 @@ where
Ok(())
}
- pub fn initial_commitment_signed_v2<L: Deref>(
+ pub fn initial_commitment_signed_v2<L: Logger>(
&mut self, msg: &msgs::CommitmentSigned, best_block: BestBlock, signer_provider: &SP,
logger: &L,
- ) -> Result<ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>, ChannelError> {
if let Some(signing_session) = self.context.interactive_tx_signing_session.as_ref() {
if signing_session.has_received_tx_signatures() {
let msg = "Received initial commitment_signed after peer's tx_signatures received!";
@@ -8139,13 +8051,10 @@ where
/// Note that our `commitment_signed` send did not include a monitor update. This is due to:
/// 1. Updates cannot be made since the state machine is paused until `tx_signatures`.
/// 2. We're still able to abort negotiation until `tx_signatures`.
- fn splice_initial_commitment_signed<F: FeeEstimator, L: Deref>(
+ fn splice_initial_commitment_signed<F: FeeEstimator, L: Logger>(
&mut self, msg: &msgs::CommitmentSigned, fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L,
- ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError> {
debug_assert!(self
.context
.interactive_tx_signing_session
@@ -8256,13 +8165,10 @@ where
(nondust_htlc_sources, dust_htlcs)
}
- pub fn commitment_signed<F: FeeEstimator, L: Deref>(
+ pub fn commitment_signed<F: FeeEstimator, L: Logger>(
&mut self, msg: &msgs::CommitmentSigned, fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L,
- ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError> {
self.commitment_signed_check_state()?;
if !self.pending_funding().is_empty() {
@@ -8299,13 +8205,10 @@ where
self.commitment_signed_update_monitor(update, logger)
}
- pub fn commitment_signed_batch<F: FeeEstimator, L: Deref>(
+ pub fn commitment_signed_batch<F: FeeEstimator, L: Logger>(
&mut self, batch: Vec<msgs::CommitmentSigned>, fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L,
- ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError> {
self.commitment_signed_check_state()?;
let mut messages = BTreeMap::new();
@@ -8403,12 +8306,9 @@ where
Ok(())
}
- fn commitment_signed_update_monitor<L: Deref>(
+ fn commitment_signed_update_monitor<L: Logger>(
&mut self, mut update: ChannelMonitorUpdateStep, logger: &L,
- ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError> {
if self
.holder_commitment_point
.advance(&self.context.holder_signer, &self.context.secp_ctx, logger)
@@ -8552,12 +8452,9 @@ where
/// Public version of the below, checking relevant preconditions first.
/// If we're not in a state where freeing the holding cell makes sense, this is a no-op and
/// returns `(None, Vec::new())`.
- pub fn maybe_free_holding_cell_htlcs<F: FeeEstimator, L: Deref>(
+ pub fn maybe_free_holding_cell_htlcs<F: FeeEstimator, L: Logger>(
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
- where
- L::Target: Logger,
- {
+ ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>) {
if matches!(self.context.channel_state, ChannelState::ChannelReady(_))
&& self.context.channel_state.can_generate_new_commitment()
{
@@ -8569,12 +8466,9 @@ where
/// Frees any pending commitment updates in the holding cell, generating the relevant messages
/// for our counterparty.
- fn free_holding_cell_htlcs<F: FeeEstimator, L: Deref>(
+ fn free_holding_cell_htlcs<F: FeeEstimator, L: Logger>(
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
- where
- L::Target: Logger,
- {
+ ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>) {
assert!(matches!(self.context.channel_state, ChannelState::ChannelReady(_)));
assert!(!self.context.channel_state.is_monitor_update_in_progress());
assert!(!self.context.channel_state.is_quiescent());
@@ -8777,7 +8671,7 @@ where
///
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc
- pub fn revoke_and_ack<F: FeeEstimator, L: Deref>(
+ pub fn revoke_and_ack<F: FeeEstimator, L: Logger>(
&mut self, msg: &msgs::RevokeAndACK, fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L, hold_mon_update: bool,
) -> Result<
@@ -8787,10 +8681,7 @@ where
Option<ChannelMonitorUpdate>,
),
ChannelError,
- >
- where
- L::Target: Logger,
- {
+ > {
if self.context.channel_state.is_quiescent() {
return Err(ChannelError::WarnAndDisconnect(
"Got revoke_and_ack message while quiescent".to_owned(),
@@ -9201,13 +9092,10 @@ where
}
}
- fn on_tx_signatures_exchange<'a, L: Deref>(
+ fn on_tx_signatures_exchange<'a, L: Logger>(
&mut self, funding_tx: Transaction, best_block_height: u32,
logger: &WithChannelContext<'a, L>,
- ) -> (Option<SpliceFundingNegotiated>, Option<msgs::SpliceLocked>)
- where
- L::Target: Logger,
- {
+ ) -> (Option<SpliceFundingNegotiated>, Option<msgs::SpliceLocked>) {
debug_assert!(!self.context.channel_state.is_monitor_update_in_progress());
debug_assert!(!self.context.channel_state.is_awaiting_remote_revoke());
@@ -9259,12 +9147,9 @@ where
}
}
- pub fn tx_signatures<L: Deref>(
+ pub fn tx_signatures<L: Logger>(
&mut self, msg: &msgs::TxSignatures, best_block_height: u32, logger: &L,
- ) -> Result<FundingTxSigned, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<FundingTxSigned, ChannelError> {
let signing_session = if let Some(signing_session) =
self.context.interactive_tx_signing_session.as_mut()
{
@@ -9336,11 +9221,9 @@ where
/// Queues up an outbound update fee by placing it in the holding cell. You should call
/// [`Self::maybe_free_holding_cell_htlcs`] in order to actually generate and send the
/// commitment update.
- pub fn queue_update_fee<F: FeeEstimator, L: Deref>(
+ pub fn queue_update_fee<F: FeeEstimator, L: Logger>(
&mut self, feerate_per_kw: u32, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
let msg_opt = self.send_update_fee(feerate_per_kw, true, fee_estimator, logger);
assert!(msg_opt.is_none(), "We forced holding cell?");
}
@@ -9353,10 +9236,10 @@ where
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
/// [`FundedChannel`] if `force_holding_cell` is false.
#[rustfmt::skip]
- fn send_update_fee<F: FeeEstimator, L: Deref>(
+ fn send_update_fee<F: FeeEstimator, L: Logger>(
&mut self, feerate_per_kw: u32, mut force_holding_cell: bool,
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
- ) -> Option<msgs::UpdateFee> where L::Target: Logger {
+ ) -> Option<msgs::UpdateFee> {
if !self.funding.is_outbound() {
panic!("Cannot send fee from inbound channel");
}
@@ -9406,7 +9289,7 @@ where
/// completed.
/// May return `Err(())`, which implies [`ChannelContext::force_shutdown`] should be called immediately.
#[rustfmt::skip]
- fn remove_uncommitted_htlcs_and_mark_paused<L: Deref>(&mut self, logger: &L) -> Result<(), ()> where L::Target: Logger {
+ fn remove_uncommitted_htlcs_and_mark_paused<L: Logger>(&mut self, logger: &L) -> Result<(), ()> {
assert!(!matches!(self.context.channel_state, ChannelState::ShutdownComplete));
if !self.context.can_resume_on_reconnect() {
return Err(())
@@ -9492,14 +9375,12 @@ where
/// [`ChannelManager`]: super::channelmanager::ChannelManager
/// [`chain::Watch`]: crate::chain::Watch
/// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
- fn monitor_updating_paused<L: Deref>(
+ fn monitor_updating_paused<L: Logger>(
&mut self, resend_raa: bool, resend_commitment: bool, resend_channel_ready: bool,
pending_forwards: Vec<(PendingHTLCInfo, u64)>,
pending_fails: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
pending_finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>, logger: &L,
- ) where
- L::Target: Logger,
- {
+ ) {
log_trace!(logger, "Pausing channel monitor updates");
self.context.monitor_pending_revoke_and_ack |= resend_raa;
@@ -9515,12 +9396,11 @@ where
/// successfully and we should restore normal operation. Returns messages which should be sent
/// to the remote side.
#[rustfmt::skip]
- pub fn monitor_updating_restored<L: Deref, NS: NodeSigner, CBP>(
+ pub fn monitor_updating_restored<L: Logger, NS: NodeSigner, CBP>(
&mut self, logger: &L, node_signer: &NS, chain_hash: ChainHash,
user_config: &UserConfig, best_block_height: u32, path_for_release_htlc: CBP
) -> MonitorRestoreUpdates
where
- L::Target: Logger,
CBP: Fn(u64) -> BlindedMessagePath
{
assert!(self.context.channel_state.is_monitor_update_in_progress());
@@ -9668,9 +9548,7 @@ where
}
#[rustfmt::skip]
- pub fn update_fee<F: FeeEstimator, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::UpdateFee, logger: &L) -> Result<(), ChannelError>
- where L::Target: Logger
- {
+ pub fn update_fee<F: FeeEstimator, L: Logger>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::UpdateFee, logger: &L) -> Result<(), ChannelError> {
if self.funding.is_outbound() {
return Err(ChannelError::close("Non-funding remote tried to update channel fee".to_owned()));
}
@@ -9696,9 +9574,9 @@ where
/// Indicates that the signer may have some signatures for us, so we should retry if we're
/// blocked.
#[rustfmt::skip]
- pub fn signer_maybe_unblocked<L: Deref, CBP>(
+ pub fn signer_maybe_unblocked<L: Logger, CBP>(
&mut self, logger: &L, path_for_release_htlc: CBP
- ) -> Result<SignerResumeUpdates, ChannelError> where L::Target: Logger, CBP: Fn(u64) -> BlindedMessagePath {
+ ) -> Result<SignerResumeUpdates, ChannelError> where CBP: Fn(u64) -> BlindedMessagePath {
if let Some((commitment_number, commitment_secret)) = self.context.signer_pending_stale_state_verification.clone() {
if let Ok(expected_point) = self.context.holder_signer.as_ref()
.get_per_commitment_point(commitment_number, &self.context.secp_ctx)
@@ -9808,11 +9686,10 @@ where
})
}
- fn get_last_revoke_and_ack<CBP, L: Deref>(
+ fn get_last_revoke_and_ack<CBP, L: Logger>(
&mut self, path_for_release_htlc: CBP, logger: &L,
) -> Option<msgs::RevokeAndACK>
where
- L::Target: Logger,
CBP: Fn(u64) -> BlindedMessagePath,
{
debug_assert!(
@@ -9867,12 +9744,9 @@ where
}
/// Gets the last commitment update for immediate sending to our peer.
- fn get_last_commitment_update_for_send<L: Deref>(
+ fn get_last_commitment_update_for_send<L: Logger>(
&mut self, logger: &L,
- ) -> Result<msgs::CommitmentUpdate, ()>
- where
- L::Target: Logger,
- {
+ ) -> Result<msgs::CommitmentUpdate, ()> {
let mut update_add_htlcs = Vec::new();
let mut update_fulfill_htlcs = Vec::new();
let mut update_fail_htlcs = Vec::new();
@@ -9984,10 +9858,7 @@ where
}
}
- fn panic_on_stale_state<L: Deref>(logger: &L)
- where
- L::Target: Logger,
- {
+ fn panic_on_stale_state<L: Logger>(logger: &L) {
macro_rules! log_and_panic {
($err_msg: expr) => {
log_error!(logger, $err_msg);
@@ -10006,13 +9877,12 @@ where
/// May panic if some calls other than message-handling calls (which will all Err immediately)
/// have been called between remove_uncommitted_htlcs_and_mark_paused and this call.
#[rustfmt::skip]
- pub fn channel_reestablish<L: Deref, NS: NodeSigner, CBP>(
+ pub fn channel_reestablish<L: Logger, NS: NodeSigner, CBP>(
&mut self, msg: &msgs::ChannelReestablish, logger: &L, node_signer: &NS,
chain_hash: ChainHash, user_config: &UserConfig, best_block: &BestBlock,
path_for_release_htlc: CBP,
) -> Result<ReestablishResponses, ChannelError>
where
- L::Target: Logger,
CBP: Fn(u64) -> BlindedMessagePath
{
if !self.context.channel_state.is_peer_disconnected() {
@@ -10480,11 +10350,9 @@ where
Ok(())
}
- pub fn maybe_propose_closing_signed<F: FeeEstimator, L: Deref>(
+ pub fn maybe_propose_closing_signed<F: FeeEstimator, L: Logger>(
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
- where
- L::Target: Logger,
{
// If we're waiting on a monitor persistence, that implies we're also waiting to send some
// message to our counterparty (probably a `revoke_and_ack`). In such a case, we shouldn't
@@ -10564,16 +10432,13 @@ where
}
}
- pub fn shutdown<L: Deref>(
+ pub fn shutdown<L: Logger>(
&mut self, logger: &L, signer_provider: &SP, their_features: &InitFeatures,
msg: &msgs::Shutdown,
) -> Result<
(Option<msgs::Shutdown>, Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>),
ChannelError,
- >
- where
- L::Target: Logger,
- {
+ > {
if self.context.channel_state.is_peer_disconnected() {
return Err(ChannelError::close(
"Peer sent shutdown when we needed a channel_reestablish".to_owned(),
@@ -10745,13 +10610,10 @@ where
tx
}
- fn get_closing_signed_msg<L: Deref>(
+ fn get_closing_signed_msg<L: Logger>(
&mut self, closing_tx: &ClosingTransaction, skip_remote_output: bool, fee_satoshis: u64,
min_fee_satoshis: u64, max_fee_satoshis: u64, logger: &L,
- ) -> Option<msgs::ClosingSigned>
- where
- L::Target: Logger,
- {
+ ) -> Option<msgs::ClosingSigned> {
let sig = match &self.context.holder_signer {
ChannelSignerType::Ecdsa(ecdsa) => ecdsa
.sign_closing_transaction(
@@ -10806,12 +10668,10 @@ where
}
}
- pub fn closing_signed<F: FeeEstimator, L: Deref>(
+ pub fn closing_signed<F: FeeEstimator, L: Logger>(
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
logger: &L,
) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
- where
- L::Target: Logger,
{
if self.is_shutdown_pending_signature() {
return Err(ChannelError::Warn(String::from("Remote end sent us a closing_signed while fully shutdown and just waiting on the final closing signature")));
@@ -11055,9 +10915,9 @@ where
/// When this function is called, the HTLC is already irrevocably committed to the channel;
/// this function determines whether to fail the HTLC, or forward / claim it.
#[rustfmt::skip]
- pub fn can_accept_incoming_htlc<F: FeeEstimator, L: Deref>(
+ pub fn can_accept_incoming_htlc<F: FeeEstimator, L: Logger>(
&self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: L
- ) -> Result<(), LocalHTLCFailureReason> where L::Target: Logger {
+ ) -> Result<(), LocalHTLCFailureReason> {
if self.context.channel_state.is_local_shutdown_sent() {
return Err(LocalHTLCFailureReason::ChannelClosed)
}
@@ -11268,9 +11128,7 @@ where
}
#[rustfmt::skip]
- fn check_get_channel_ready<L: Deref>(&mut self, height: u32, logger: &L) -> Option<msgs::ChannelReady>
- where L::Target: Logger
- {
+ fn check_get_channel_ready<L: Logger>(&mut self, height: u32, logger: &L) -> Option<msgs::ChannelReady> {
// Called:
// * always when a new block/transactions are confirmed with the new height
// * when funding is signed with a height of 0
@@ -11327,9 +11185,9 @@ where
}
#[rustfmt::skip]
- fn get_channel_ready<L: Deref>(
+ fn get_channel_ready<L: Logger>(
&mut self, logger: &L
- ) -> Option<msgs::ChannelReady> where L::Target: Logger {
+ ) -> Option<msgs::ChannelReady> {
if self.holder_commitment_point.can_advance() {
self.context.signer_pending_channel_ready = false;
Some(msgs::ChannelReady {
@@ -11349,13 +11207,10 @@ where
}
/// Returns `Some` if a splice [`FundingScope`] was promoted.
- fn maybe_promote_splice_funding<NS: NodeSigner, L: Deref>(
+ fn maybe_promote_splice_funding<NS: NodeSigner, L: Logger>(
&mut self, node_signer: &NS, chain_hash: ChainHash, user_config: &UserConfig,
block_height: u32, logger: &L,
- ) -> Option<SpliceFundingPromotion>
- where
- L::Target: Logger,
- {
+ ) -> Option<SpliceFundingPromotion> {
debug_assert!(self.pending_splice.is_some());
let pending_splice = self.pending_splice.as_mut().unwrap();
@@ -11469,13 +11324,10 @@ where
/// In the first case, we store the confirmation height and calculating the short channel id.
/// In the second, we simply return an Err indicating we need to be force-closed now.
#[rustfmt::skip]
- pub fn transactions_confirmed<NS: NodeSigner, L: Deref>(
+ pub fn transactions_confirmed<NS: NodeSigner, L: Logger>(
&mut self, block_hash: &BlockHash, height: u32, txdata: &TransactionData,
chain_hash: ChainHash, node_signer: &NS, user_config: &UserConfig, logger: &L
- ) -> Result<(Option<FundingConfirmedMessage>, Option<msgs::AnnouncementSignatures>), ClosureReason>
- where
- L::Target: Logger
- {
+ ) -> Result<(Option<FundingConfirmedMessage>, Option<msgs::AnnouncementSignatures>), ClosureReason> {
for &(index_in_block, tx) in txdata.iter() {
let mut confirmed_tx = ConfirmedTransaction::from(tx);
@@ -11566,13 +11418,10 @@ where
///
/// May return some HTLCs (and their payment_hash) which have timed out and should be failed
/// back.
- pub fn best_block_updated<NS: NodeSigner, L: Deref>(
+ pub fn best_block_updated<NS: NodeSigner, L: Logger>(
&mut self, height: u32, highest_header_time: Option<u32>, chain_hash: ChainHash,
node_signer: &NS, user_config: &UserConfig, logger: &L,
- ) -> Result<BestBlockUpdatedRes, ClosureReason>
- where
- L::Target: Logger,
- {
+ ) -> Result<BestBlockUpdatedRes, ClosureReason> {
self.do_best_block_updated(
height,
highest_header_time,
@@ -11582,13 +11431,10 @@ where
}
#[rustfmt::skip]
- fn do_best_block_updated<NS: NodeSigner, L: Deref>(
+ fn do_best_block_updated<NS: NodeSigner, L: Logger>(
&mut self, height: u32, highest_header_time: Option<u32>,
chain_node_signer: Option<(ChainHash, &NS, &UserConfig)>, logger: &L
- ) -> Result<(Option<FundingConfirmedMessage>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason>
- where
- L::Target: Logger
- {
+ ) -> Result<(Option<FundingConfirmedMessage>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason> {
let mut timed_out_htlcs = Vec::new();
// This mirrors the check in ChannelManager::decode_update_add_htlc_onion, refusing to
// forward an HTLC when our counterparty should almost certainly just fail it for expiring
@@ -11764,12 +11610,9 @@ where
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
/// blocks.
#[rustfmt::skip]
- pub fn transaction_unconfirmed<L: Deref>(
+ pub fn transaction_unconfirmed<L: Logger>(
&mut self, txid: &Txid, logger: &L,
- ) -> Result<(), ClosureReason>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), ClosureReason> {
let unconfirmed_funding = self
.funding_and_pending_funding_iter_mut()
.find(|funding| funding.get_funding_txid() == Some(*txid));
@@ -11846,13 +11689,10 @@ where
}
#[rustfmt::skip]
- fn get_announcement_sigs<NS: NodeSigner, L: Deref>(
+ fn get_announcement_sigs<NS: NodeSigner, L: Logger>(
&mut self, node_signer: &NS, chain_hash: ChainHash, user_config: &UserConfig,
best_block_height: u32, logger: &L
- ) -> Option<msgs::AnnouncementSignatures>
- where
- L::Target: Logger
- {
+ ) -> Option<msgs::AnnouncementSignatures> {
if self.funding.funding_tx_confirmation_height == 0 || self.funding.funding_tx_confirmation_height + 5 > best_block_height {
return None;
}
@@ -12059,7 +11899,7 @@ where
/// May panic if called on a channel that wasn't immediately-previously
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
#[rustfmt::skip]
- fn get_channel_reestablish<L: Deref>(&mut self, logger: &L) -> msgs::ChannelReestablish where L::Target: Logger {
+ fn get_channel_reestablish<L: Logger>(&mut self, logger: &L) -> msgs::ChannelReestablish {
assert!(self.context.channel_state.is_peer_disconnected());
assert_ne!(self.context.counterparty_next_commitment_transaction_number, INITIAL_COMMITMENT_NUMBER);
// This is generally the first function which gets called on any given channel once we're
@@ -12116,13 +11956,10 @@ where
/// Includes the witness weight for this input (e.g. P2WPKH_WITNESS_WEIGHT=109 for typical P2WPKH inputs).
/// - `change_script`: an option change output script. If `None` and needed, one will be
/// generated by `SignerProvider::get_destination_script`.
- pub fn splice_channel<L: Deref>(
+ pub fn splice_channel<L: Logger>(
&mut self, contribution: SpliceContribution, funding_feerate_per_kw: u32, locktime: u32,
logger: &L,
- ) -> Result<Option<msgs::Stfu>, APIError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<msgs::Stfu>, APIError> {
if self.holder_commitment_point.current_point().is_none() {
return Err(APIError::APIMisuseError {
err: format!(
@@ -12465,13 +12302,10 @@ where
Ok(())
}
- pub(crate) fn splice_init<ES: EntropySource, L: Deref>(
+ pub(crate) fn splice_init<ES: EntropySource, L: Logger>(
&mut self, msg: &msgs::SpliceInit, our_funding_contribution_satoshis: i64,
signer_provider: &SP, entropy_source: &ES, holder_node_id: &PublicKey, logger: &L,
- ) -> Result<msgs::SpliceAck, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<msgs::SpliceAck, ChannelError> {
let our_funding_contribution = SignedAmount::from_sat(our_funding_contribution_satoshis);
let splice_funding = self.validate_splice_init(msg, our_funding_contribution)?;
@@ -12535,13 +12369,10 @@ where
})
}
- pub(crate) fn splice_ack<ES: EntropySource, L: Deref>(
+ pub(crate) fn splice_ack<ES: EntropySource, L: Logger>(
&mut self, msg: &msgs::SpliceAck, signer_provider: &SP, entropy_source: &ES,
holder_node_id: &PublicKey, logger: &L,
- ) -> Result<Option<InteractiveTxMessageSend>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<InteractiveTxMessageSend>, ChannelError> {
let splice_funding = self.validate_splice_ack(msg)?;
log_info!(
@@ -12688,13 +12519,10 @@ where
Ok((holder_balance_floor, counterparty_balance_floor))
}
- pub fn splice_locked<NS: NodeSigner, L: Deref>(
+ pub fn splice_locked<NS: NodeSigner, L: Logger>(
&mut self, msg: &msgs::SpliceLocked, node_signer: &NS, chain_hash: ChainHash,
user_config: &UserConfig, block_height: u32, logger: &L,
- ) -> Result<Option<SpliceFundingPromotion>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<SpliceFundingPromotion>, ChannelError> {
log_info!(logger, "Received splice_locked txid {} from our peer", msg.splice_txid,);
let pending_splice = match self.pending_splice.as_mut() {
@@ -12735,15 +12563,12 @@ where
/// Queues up an outbound HTLC to send by placing it in the holding cell. You should call
/// [`Self::maybe_free_holding_cell_htlcs`] in order to actually generate and send the
/// commitment update.
- pub fn queue_add_htlc<F: FeeEstimator, L: Deref>(
+ pub fn queue_add_htlc<F: FeeEstimator, L: Logger>(
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
blinding_point: Option<PublicKey>, accountable: bool,
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> Result<(), (LocalHTLCFailureReason, String)>
- where
- L::Target: Logger,
- {
+ ) -> Result<(), (LocalHTLCFailureReason, String)> {
self.send_htlc(
amount_msat,
payment_hash,
@@ -12783,15 +12608,12 @@ where
/// on this [`FundedChannel`] if `force_holding_cell` is false.
///
/// `Err`'s will always be temporary channel failures.
- fn send_htlc<F: FeeEstimator, L: Deref>(
+ fn send_htlc<F: FeeEstimator, L: Logger>(
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
source: HTLCSource, onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
skimmed_fee_msat: Option<u64>, blinding_point: Option<PublicKey>, hold_htlc: bool,
accountable: bool, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
- ) -> Result<bool, (LocalHTLCFailureReason, String)>
- where
- L::Target: Logger,
- {
+ ) -> Result<bool, (LocalHTLCFailureReason, String)> {
if !matches!(self.context.channel_state, ChannelState::ChannelReady(_))
|| self.context.channel_state.is_local_shutdown_sent()
|| self.context.channel_state.is_remote_shutdown_sent()
@@ -12916,10 +12738,7 @@ where
.expect("At least one FundingScope is always provided")
}
- fn build_commitment_no_status_check<L: Deref>(&mut self, logger: &L) -> ChannelMonitorUpdate
- where
- L::Target: Logger,
- {
+ fn build_commitment_no_status_check<L: Logger>(&mut self, logger: &L) -> ChannelMonitorUpdate {
log_trace!(logger, "Updating HTLC state for a newly-sent commitment_signed...");
// We can upgrade the status of some HTLCs that are waiting on a commitment, even if we
// fail to generate this, we still are at least at a position where upgrading their status
@@ -13037,12 +12856,9 @@ where
}
#[rustfmt::skip]
- fn build_commitment_no_state_update<L: Deref>(
+ fn build_commitment_no_state_update<L: Logger>(
&self, funding: &FundingScope, logger: &L,
- ) -> (Vec<(HTLCOutputInCommitment, Option<&HTLCSource>)>, CommitmentTransaction)
- where
- L::Target: Logger,
- {
+ ) -> (Vec<(HTLCOutputInCommitment, Option<&HTLCSource>)>, CommitmentTransaction) {
let commitment_data = self.context.build_commitment_transaction(
funding, self.context.counterparty_next_commitment_transaction_number,
&self.context.counterparty_next_commitment_point.unwrap(), false, true, logger,
@@ -13054,12 +12870,9 @@ where
/// Only fails in case of signer rejection. Used for channel_reestablish commitment_signed
/// generation when we shouldn't change HTLC/channel state.
- fn send_commitment_no_state_update<L: Deref>(
+ fn send_commitment_no_state_update<L: Logger>(
&self, logger: &L,
- ) -> Result<Vec<msgs::CommitmentSigned>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Vec<msgs::CommitmentSigned>, ChannelError> {
core::iter::once(&self.funding)
.chain(self.pending_funding().iter())
.map(|funding| self.send_commitment_no_state_update_for_funding(funding, logger))
@@ -13067,12 +12880,9 @@ where
}
#[rustfmt::skip]
- fn send_commitment_no_state_update_for_funding<L: Deref>(
+ fn send_commitment_no_state_update_for_funding<L: Logger>(
&self, funding: &FundingScope, logger: &L,
- ) -> Result<msgs::CommitmentSigned, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<msgs::CommitmentSigned, ChannelError> {
// Get the fee tests from `build_commitment_no_state_update`
#[cfg(any(test, fuzzing))]
self.build_commitment_no_state_update(funding, logger);
@@ -13135,15 +12945,12 @@ where
///
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
- pub fn send_htlc_and_commit<F: FeeEstimator, L: Deref>(
+ pub fn send_htlc_and_commit<F: FeeEstimator, L: Logger>(
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
hold_htlc: bool, accountable: bool, fee_estimator: &LowerBoundedFeeEstimator<F>,
logger: &L,
- ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError> {
let send_res = self.send_htlc(
amount_msat,
payment_hash,
@@ -13196,17 +13003,14 @@ where
/// Begins the shutdown process, getting a message for the remote peer and returning all
/// holding cell HTLCs for payment failure.
- pub fn get_shutdown<L: Deref>(
+ pub fn get_shutdown<L: Logger>(
&mut self, signer_provider: &SP, their_features: &InitFeatures,
target_feerate_sats_per_kw: Option<u32>, override_shutdown_script: Option<ShutdownScript>,
logger: &L,
) -> Result<
(msgs::Shutdown, Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>),
APIError,
- >
- where
- L::Target: Logger,
- {
+ > {
let logger = WithChannelContext::from(logger, &self.context, None);
if self.context.channel_state.is_local_stfu_sent()
@@ -13358,12 +13162,9 @@ where
}
#[rustfmt::skip]
- pub fn propose_quiescence<L: Deref>(
+ pub fn propose_quiescence<L: Logger>(
&mut self, logger: &L, action: QuiescentAction,
- ) -> Result<Option<msgs::Stfu>, &'static str>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<msgs::Stfu>, &'static str> {
log_debug!(logger, "Attempting to initiate quiescence");
if !self.context.is_usable() {
@@ -13399,10 +13200,7 @@ where
// Assumes we are either awaiting quiescence or our counterparty has requested quiescence.
#[rustfmt::skip]
- pub fn send_stfu<L: Deref>(&mut self, logger: &L) -> Result<msgs::Stfu, &'static str>
- where
- L::Target: Logger,
- {
+ pub fn send_stfu<L: Logger>(&mut self, logger: &L) -> Result<msgs::Stfu, &'static str> {
debug_assert!(!self.context.channel_state.is_local_stfu_sent());
debug_assert!(
self.context.channel_state.is_awaiting_quiescence()
@@ -13437,9 +13235,9 @@ where
}
#[rustfmt::skip]
- pub fn stfu<L: Deref>(
+ pub fn stfu<L: Logger>(
&mut self, msg: &msgs::Stfu, logger: &L
- ) -> Result<Option<StfuResponse>, ChannelError> where L::Target: Logger {
+ ) -> Result<Option<StfuResponse>, ChannelError> {
if self.context.channel_state.is_quiescent() {
return Err(ChannelError::Warn("Channel is already quiescent".to_owned()));
}
@@ -13540,12 +13338,9 @@ where
Ok(None)
}
- pub fn try_send_stfu<L: Deref>(
+ pub fn try_send_stfu<L: Logger>(
&mut self, logger: &L,
- ) -> Result<Option<msgs::Stfu>, ChannelError>
- where
- L::Target: Logger,
- {
+ ) -> Result<Option<msgs::Stfu>, ChannelError> {
// We must never see both stfu flags set, we always set the quiescent flag instead.
debug_assert!(
!(self.context.channel_state.is_local_stfu_sent()
@@ -13639,11 +13434,11 @@ where
#[allow(dead_code)] // TODO(dual_funding): Remove once opending V2 channels is enabled.
#[rustfmt::skip]
- pub fn new<ES: EntropySource, F: FeeEstimator, L: Deref>(
+ pub fn new<ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP, counterparty_node_id: PublicKey, their_features: &InitFeatures,
channel_value_satoshis: u64, push_msat: u64, user_id: u128, config: &UserConfig, current_chain_height: u32,
outbound_scid_alias: u64, temporary_channel_id: Option<ChannelId>, logger: L
- ) -> Result<OutboundV1Channel<SP>, APIError> where L::Target: Logger {
+ ) -> Result<OutboundV1Channel<SP>, APIError> {
let holder_selected_channel_reserve_satoshis = get_holder_selected_channel_reserve_satoshis(channel_value_satoshis, config);
if holder_selected_channel_reserve_satoshis < MIN_CHAN_DUST_LIMIT_SATOSHIS {
// Protocol level safety check in place, although it should never happen because
@@ -13690,7 +13485,7 @@ where
/// Only allowed after [`FundingScope::channel_transaction_parameters`] is set.
#[rustfmt::skip]
- fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
+ fn get_funding_created_msg<L: Logger>(&mut self, logger: &L) -> Option<msgs::FundingCreated> {
let commitment_data = self.context.build_commitment_transaction(&self.funding,
self.context.counterparty_next_commitment_transaction_number,
&self.context.counterparty_next_commitment_point.unwrap(), false, false, logger);
@@ -13735,8 +13530,8 @@ where
/// Do NOT broadcast the funding transaction until after a successful funding_signed call!
/// If an Err is returned, it is a ChannelError::Close.
#[rustfmt::skip]
- pub fn get_funding_created<L: Deref>(&mut self, funding_transaction: Transaction, funding_txo: OutPoint, is_batch_funding: bool, logger: &L)
- -> Result<Option<msgs::FundingCreated>, (Self, ChannelError)> where L::Target: Logger {
+ pub fn get_funding_created<L: Logger>(&mut self, funding_transaction: Transaction, funding_txo: OutPoint, is_batch_funding: bool, logger: &L)
+ -> Result<Option<msgs::FundingCreated>, (Self, ChannelError)> {
if !self.funding.is_outbound() {
panic!("Tried to create outbound funding_created message on an inbound channel!");
}
@@ -13775,10 +13570,10 @@ where
/// not of our ability to open any channel at all. Thus, on error, we should first call this
/// and see if we get a new `OpenChannel` message, otherwise the channel is failed.
#[rustfmt::skip]
- pub(crate) fn maybe_handle_error_without_close<F: FeeEstimator, L: Deref>(
+ pub(crate) fn maybe_handle_error_without_close<F: FeeEstimator, L: Logger>(
&mut self, chain_hash: ChainHash, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
user_config: &UserConfig, their_features: &InitFeatures,
- ) -> Result<msgs::OpenChannel, ()> where L::Target: Logger, {
+ ) -> Result<msgs::OpenChannel, ()> {
self.context.maybe_downgrade_channel_features(
&mut self.funding, fee_estimator, user_config, their_features,
)?;
@@ -13792,9 +13587,9 @@ where
}
#[rustfmt::skip]
- pub fn get_open_channel<L: Deref>(
+ pub fn get_open_channel<L: Logger>(
&mut self, chain_hash: ChainHash, _logger: &L
- ) -> Option<msgs::OpenChannel> where L::Target: Logger {
+ ) -> Option<msgs::OpenChannel> {
if !self.funding.is_outbound() {
panic!("Tried to open a channel for an inbound channel?");
}
@@ -13864,16 +13659,13 @@ where
/// Handles a funding_signed message from the remote end.
/// If this call is successful, broadcast the funding transaction (and not before!)
- pub fn funding_signed<L: Deref>(
+ pub fn funding_signed<L: Logger>(
mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP,
logger: &L,
) -> Result<
(FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>),
(OutboundV1Channel<SP>, ChannelError),
- >
- where
- L::Target: Logger,
- {
+ > {
if !self.funding.is_outbound() {
let err = "Received funding_signed for an inbound channel?";
return Err((self, ChannelError::close(err.to_owned())));
@@ -13937,9 +13729,9 @@ where
/// Indicates that the signer may have some signatures for us, so we should retry if we're
/// blocked.
#[rustfmt::skip]
- pub fn signer_maybe_unblocked<L: Deref>(
+ pub fn signer_maybe_unblocked<L: Logger>(
&mut self, chain_hash: ChainHash, logger: &L
- ) -> (Option<msgs::OpenChannel>, Option<msgs::FundingCreated>) where L::Target: Logger {
+ ) -> (Option<msgs::OpenChannel>, Option<msgs::FundingCreated>) {
// If we were pending a commitment point, retry the signer and advance to an
// available state.
if self.unfunded_context.holder_commitment_point.is_none() {
@@ -14023,12 +13815,12 @@ where
/// Creates a new channel from a remote sides' request for one.
/// Assumes chain_hash has already been checked and corresponds with what we expect!
#[rustfmt::skip]
- pub fn new<ES: EntropySource, F: FeeEstimator, L: Deref>(
+ pub fn new<ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
counterparty_node_id: PublicKey, our_supported_features: &ChannelTypeFeatures,
their_features: &InitFeatures, msg: &msgs::OpenChannel, user_id: u128, config: &UserConfig,
current_chain_height: u32, logger: &L, is_0conf: bool,
- ) -> Result<InboundV1Channel<SP>, ChannelError> where L::Target: Logger {
+ ) -> Result<InboundV1Channel<SP>, ChannelError> {
let logger = WithContext::from(logger, Some(counterparty_node_id), Some(msg.common_fields.temporary_channel_id), None);
// First check the channel type is known, failing before we do anything else if we don't
@@ -14076,10 +13868,7 @@ where
/// should be sent back to the counterparty node.
///
/// [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
- pub fn accept_inbound_channel<L: Deref>(&mut self, logger: &L) -> Option<msgs::AcceptChannel>
- where
- L::Target: Logger,
- {
+ pub fn accept_inbound_channel<L: Logger>(&mut self, logger: &L) -> Option<msgs::AcceptChannel> {
if self.funding.is_outbound() {
panic!("Tried to send accept_channel for an outbound channel?");
}
@@ -14102,9 +13891,9 @@ where
///
/// [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
#[rustfmt::skip]
- fn generate_accept_channel_message<L: Deref>(
+ fn generate_accept_channel_message<L: Logger>(
&mut self, _logger: &L
- ) -> Option<msgs::AcceptChannel> where L::Target: Logger {
+ ) -> Option<msgs::AcceptChannel> {
let first_per_commitment_point = match self.unfunded_context.holder_commitment_point {
Some(holder_commitment_point) if holder_commitment_point.can_advance() => {
self.signer_pending_accept_channel = false;
@@ -14150,16 +13939,13 @@ where
///
/// [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
#[cfg(test)]
- pub fn get_accept_channel_message<L: Deref>(
+ pub fn get_accept_channel_message<L: Logger>(
&mut self, logger: &L,
- ) -> Option<msgs::AcceptChannel>
- where
- L::Target: Logger,
- {
+ ) -> Option<msgs::AcceptChannel> {
self.generate_accept_channel_message(logger)
}
- pub fn funding_created<L: Deref>(
+ pub fn funding_created<L: Logger>(
mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: &SP,
logger: &L,
) -> Result<
@@ -14169,10 +13955,7 @@ where
ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>,
),
(Self, ChannelError),
- >
- where
- L::Target: Logger,
- {
+ > {
if self.funding.is_outbound() {
let err = "Received funding_created for an outbound channel?";
return Err((self, ChannelError::close(err.to_owned())));
@@ -14256,9 +14039,9 @@ where
/// Indicates that the signer may have some signatures for us, so we should retry if we're
/// blocked.
#[rustfmt::skip]
- pub fn signer_maybe_unblocked<L: Deref>(
+ pub fn signer_maybe_unblocked<L: Logger>(
&mut self, logger: &L
- ) -> Option<msgs::AcceptChannel> where L::Target: Logger {
+ ) -> Option<msgs::AcceptChannel> {
if self.unfunded_context.holder_commitment_point.is_none() {
self.unfunded_context.holder_commitment_point = HolderCommitmentPoint::new(&self.context.holder_signer, &self.context.secp_ctx);
}
@@ -14293,13 +14076,13 @@ where
{
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
#[rustfmt::skip]
- pub fn new_outbound<ES: EntropySource, F: FeeEstimator, L: Deref>(
+ pub fn new_outbound<ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
counterparty_node_id: PublicKey, their_features: &InitFeatures, funding_satoshis: u64,
funding_inputs: Vec<FundingTxInput>, user_id: u128, config: &UserConfig,
current_chain_height: u32, outbound_scid_alias: u64, funding_confirmation_target: ConfirmationTarget,
logger: L,
- ) -> Result<Self, APIError> where L::Target: Logger {
+ ) -> Result<Self, APIError> {
let channel_keys_id = signer_provider.generate_channel_keys_id(false, user_id);
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -14435,12 +14218,12 @@ where
/// TODO(dual_funding): Allow contributions, pass intended amount and inputs
#[allow(dead_code)] // TODO(dual_funding): Remove once V2 channels is enabled.
#[rustfmt::skip]
- pub fn new_inbound<ES: EntropySource, F: FeeEstimator, L: Deref>(
+ pub fn new_inbound<ES: EntropySource, F: FeeEstimator, L: Logger>(
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
holder_node_id: PublicKey, counterparty_node_id: PublicKey, our_supported_features: &ChannelTypeFeatures,
their_features: &InitFeatures, msg: &msgs::OpenChannelV2,
user_id: u128, config: &UserConfig, current_chain_height: u32, logger: &L,
- ) -> Result<Self, ChannelError> where L::Target: Logger, {
+ ) -> Result<Self, ChannelError> {
// TODO(dual_funding): Take these as input once supported
let (our_funding_contribution, our_funding_contribution_sats) = (SignedAmount::ZERO, 0u64);
let our_funding_inputs = Vec::new();
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 1d3f8ec..7ee7b6d 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -1163,12 +1163,10 @@ impl ClaimablePayments {
///
/// If no payment is found, `Err(Vec::new())` is returned.
#[rustfmt::skip]
- fn begin_claiming_payment<L: Deref, S: NodeSigner>(
+ fn begin_claiming_payment<L: Logger, S: NodeSigner>(
&mut self, payment_hash: PaymentHash, node_signer: &S, logger: &L,
inbound_payment_id_secret: &[u8; 32], custom_tlvs_known: bool,
- ) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>>
- where L::Target: Logger,
- {
+ ) -> Result<(Vec<ClaimableHTLC>, ClaimingPayment), Vec<ClaimableHTLC>> {
match self.claimable_payments.remove(&payment_hash) {
Some(payment) => {
let mut receiver_node_id = node_signer.get_node_id(Recipient::Node)
@@ -1807,9 +1805,7 @@ pub trait AChannelManager {
/// A type implementing [`MessageRouter`].
type MessageRouter: MessageRouter;
/// A type implementing [`Logger`].
- type Logger: Logger + ?Sized;
- /// A type that may be dereferenced to [`Self::Logger`].
- type L: Deref<Target = Self::Logger>;
+ type Logger: Logger;
/// Returns a reference to the actual [`ChannelManager`] object.
fn get_cm(
&self,
@@ -1822,7 +1818,7 @@ pub trait AChannelManager {
Self::FeeEstimator,
Self::Router,
Self::MessageRouter,
- Self::L,
+ Self::Logger,
>;
}
@@ -1835,12 +1831,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> AChannelManager for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
type Watch = M::Target;
type M = M;
@@ -1853,8 +1848,7 @@ where
type FeeEstimator = F;
type Router = R;
type MessageRouter = MR;
- type Logger = L::Target;
- type L = L;
+ type Logger = L;
fn get_cm(&self) -> &ChannelManager<M, T, ES, NS, SP, F, R, MR, L> {
self
}
@@ -2608,11 +2602,10 @@ pub struct ChannelManager<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
config: RwLock<UserConfig>,
chain_hash: ChainHash,
@@ -3392,12 +3385,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Constructs a new `ChannelManager` to hold several channels and route between them.
///
@@ -3635,7 +3627,7 @@ where
};
match OutboundV1Channel::new(&self.fee_estimator, &self.entropy_source, &self.signer_provider, their_network_key,
their_features, channel_value_satoshis, push_msat, user_channel_id, config,
- self.best_block.read().unwrap().height, outbound_scid_alias, temporary_channel_id, &*self.logger)
+ self.best_block.read().unwrap().height, outbound_scid_alias, temporary_channel_id, &self.logger)
{
Ok(res) => res,
Err(e) => {
@@ -6913,7 +6905,7 @@ where
match decode_incoming_update_add_htlc_onion(
&update_add_htlc,
&self.node_signer,
- &*self.logger,
+ &self.logger,
&self.secp_ctx,
) {
Ok(decoded_onion) => match decoded_onion {
@@ -13521,12 +13513,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
#[cfg(not(c_bindings))]
create_offer_builder!(self, OfferBuilder<'_, DerivedMetadata, secp256k1::All>);
@@ -14392,12 +14383,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> BaseMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn provided_node_features(&self) -> NodeFeatures {
provided_node_features(&self.config.read().unwrap())
@@ -14757,12 +14747,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> EventsProvider for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Processes events that must be periodically handled.
///
@@ -14786,12 +14775,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> chain::Listen for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) {
{
@@ -14841,12 +14829,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> chain::Confirm for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
#[rustfmt::skip]
fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData, height: u32) {
@@ -15008,12 +14995,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Calls a function which handles an on-chain event (blocks dis/connected, transactions
/// un/confirmed, etc) on each channel, handling any resulting errors or messages generated by
@@ -15364,12 +15350,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> ChannelMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn handle_open_channel(&self, counterparty_node_id: PublicKey, message: &msgs::OpenChannel) {
// Note that we never need to persist the updated ChannelManager for an inbound
@@ -15933,12 +15918,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> OffersMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
#[rustfmt::skip]
fn handle_message(
@@ -16145,12 +16129,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> AsyncPaymentsMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn handle_offer_paths_request(
&self, message: OfferPathsRequest, context: AsyncPaymentsContext,
@@ -16384,12 +16367,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> DNSResolverMessageHandler for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn handle_dnssec_query(
&self, _message: DNSSECQuery, _responder: Option<Responder>,
@@ -16446,12 +16428,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> NodeIdLookUp for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn next_node_id(&self, short_channel_id: u64) -> Option<PublicKey> {
self.short_to_chan_info.read().unwrap().get(&short_channel_id).map(|(pubkey, _)| *pubkey)
@@ -16956,12 +16937,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref,
+ L: Logger,
> Writeable for ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
#[rustfmt::skip]
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
@@ -17317,11 +17297,10 @@ pub struct ChannelManagerReadArgs<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref + Clone,
+ L: Logger + Clone,
> where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// A cryptographically secure source of entropy.
pub entropy_source: ES,
@@ -17391,12 +17370,11 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref + Clone,
+ L: Logger + Clone,
> ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
/// Simple utility function to create a ChannelManagerReadArgs which creates the monitor
/// HashMap for you. This is primarily useful for C bindings where it is not practical to
@@ -17427,12 +17405,10 @@ where
// If the HTLC corresponding to `prev_hop_data` is present in `decode_update_add_htlcs`, remove it
// from the map as it is already being stored and processed elsewhere.
-fn dedup_decode_update_add_htlcs<L: Deref>(
+fn dedup_decode_update_add_htlcs<L: Logger>(
decode_update_add_htlcs: &mut HashMap<u64, Vec<msgs::UpdateAddHTLC>>,
prev_hop_data: &HTLCPreviousHopData, removal_reason: &'static str, logger: &L,
-) where
- L::Target: Logger,
-{
+) {
match decode_update_add_htlcs.entry(prev_hop_data.prev_outbound_scid_alias) {
hash_map::Entry::Occupied(mut update_add_htlcs) => {
update_add_htlcs.get_mut().retain(|update_add| {
@@ -17473,13 +17449,12 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref + Clone,
+ L: Logger + Clone,
> ReadableArgs<ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>>
for (BlockHash, Arc<ChannelManager<M, T, ES, NS, SP, F, R, MR, L>>)
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn read<Reader: io::Read>(
reader: &mut Reader, args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>,
@@ -17500,13 +17475,12 @@ impl<
F: FeeEstimator,
R: Router,
MR: MessageRouter,
- L: Deref + Clone,
+ L: Logger + Clone,
> ReadableArgs<ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>>
for (BlockHash, ChannelManager<M, T, ES, NS, SP, F, R, MR, L>)
where
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
SP::Target: SignerProvider,
- L::Target: Logger,
{
fn read<Reader: io::Read>(
reader: &mut Reader, mut args: ChannelManagerReadArgs<'a, M, T, ES, NS, SP, F, R, MR, L>,
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index c425bda..bc75407 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -740,7 +740,7 @@ pub trait NodeHolder {
<Self::CM as AChannelManager>::FeeEstimator,
<Self::CM as AChannelManager>::Router,
<Self::CM as AChannelManager>::MessageRouter,
- <Self::CM as AChannelManager>::L,
+ <Self::CM as AChannelManager>::Logger,
>;
fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor<'_>>;
}
@@ -757,7 +757,7 @@ impl<H: NodeHolder> NodeHolder for &H {
<Self::CM as AChannelManager>::FeeEstimator,
<Self::CM as AChannelManager>::Router,
<Self::CM as AChannelManager>::MessageRouter,
- <Self::CM as AChannelManager>::L,
+ <Self::CM as AChannelManager>::Logger,
> {
(*self).node()
}
diff --git a/lightning/src/ln/inbound_payment.rs b/lightning/src/ln/inbound_payment.rs
index 03e271d..51f8b7b 100644
--- a/lightning/src/ln/inbound_payment.rs
+++ b/lightning/src/ln/inbound_payment.rs
@@ -27,8 +27,6 @@ use crate::util::logger::Logger;
#[allow(unused_imports)]
use crate::prelude::*;
-use core::ops::Deref;
-
pub(crate) const IV_LEN: usize = 16;
const METADATA_LEN: usize = 16;
const METADATA_KEY_LEN: usize = 32;
@@ -342,13 +340,10 @@ fn construct_payment_secret(
/// [`NodeSigner::get_expanded_key`]: crate::sign::NodeSigner::get_expanded_key
/// [`create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
/// [`create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
-pub(super) fn verify<L: Deref>(
+pub(super) fn verify<L: Logger>(
payment_hash: PaymentHash, payment_data: &msgs::FinalOnionHopData, highest_seen_timestamp: u64,
keys: &ExpandedKey, logger: &L,
-) -> Result<(Option<PaymentPreimage>, Option<u16>), ()>
-where
- L::Target: Logger,
-{
+) -> Result<(Option<PaymentPreimage>, Option<u16>), ()> {
let (iv_bytes, metadata_bytes) = decrypt_metadata(payment_data.payment_secret, keys);
let payment_type_res =
diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs
index e99f53a..43f80af 100644
--- a/lightning/src/ln/invoice_utils.rs
+++ b/lightning/src/ln/invoice_utils.rs
@@ -22,7 +22,6 @@ use bitcoin::hashes::Hash;
use bitcoin::secp256k1::PublicKey;
#[cfg(not(feature = "std"))]
use core::iter::Iterator;
-use core::ops::Deref;
use core::time::Duration;
/// Utility to create an invoice that can be paid to one of multiple nodes, or a "phantom invoice."
@@ -67,15 +66,12 @@ use core::time::Duration;
feature = "std",
doc = "This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller."
)]
-pub fn create_phantom_invoice<ES: EntropySource, NS: NodeSigner, L: Deref>(
+pub fn create_phantom_invoice<ES: EntropySource, NS: NodeSigner, L: Logger>(
amt_msat: Option<u64>, payment_hash: Option<PaymentHash>, description: String,
invoice_expiry_delta_secs: u32, phantom_route_hints: Vec<PhantomRouteHints>,
entropy_source: ES, node_signer: NS, logger: L, network: Currency,
min_final_cltv_expiry_delta: Option<u16>, duration_since_epoch: Duration,
-) -> Result<Bolt11Invoice, SignOrCreationError<()>>
-where
- L::Target: Logger,
-{
+) -> Result<Bolt11Invoice, SignOrCreationError<()>> {
let description = Description::new(description).map_err(SignOrCreationError::CreationError)?;
let description = Bolt11InvoiceDescription::Direct(description);
_create_phantom_invoice::<ES, NS, L>(
@@ -133,15 +129,16 @@ where
feature = "std",
doc = "This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller."
)]
-pub fn create_phantom_invoice_with_description_hash<ES: EntropySource, NS: NodeSigner, L: Deref>(
+pub fn create_phantom_invoice_with_description_hash<
+ ES: EntropySource,
+ NS: NodeSigner,
+ L: Logger,
+>(
amt_msat: Option<u64>, payment_hash: Option<PaymentHash>, invoice_expiry_delta_secs: u32,
description_hash: Sha256, phantom_route_hints: Vec<PhantomRouteHints>, entropy_source: ES,
node_signer: NS, logger: L, network: Currency, min_final_cltv_expiry_delta: Option<u16>,
duration_since_epoch: Duration,
-) -> Result<Bolt11Invoice, SignOrCreationError<()>>
-where
- L::Target: Logger,
-{
+) -> Result<Bolt11Invoice, SignOrCreationError<()>> {
_create_phantom_invoice::<ES, NS, L>(
amt_msat,
payment_hash,
@@ -159,15 +156,12 @@ where
const MAX_CHANNEL_HINTS: usize = 3;
-fn _create_phantom_invoice<ES: EntropySource, NS: NodeSigner, L: Deref>(
+fn _create_phantom_invoice<ES: EntropySource, NS: NodeSigner, L: Logger>(
amt_msat: Option<u64>, payment_hash: Option<PaymentHash>,
description: Bolt11InvoiceDescription, invoice_expiry_delta_secs: u32,
phantom_route_hints: Vec<PhantomRouteHints>, entropy_source: ES, node_signer: NS, logger: L,
network: Currency, min_final_cltv_expiry_delta: Option<u16>, duration_since_epoch: Duration,
-) -> Result<Bolt11Invoice, SignOrCreationError<()>>
-where
- L::Target: Logger,
-{
+) -> Result<Bolt11Invoice, SignOrCreationError<()>> {
if phantom_route_hints.is_empty() {
return Err(SignOrCreationError::CreationError(CreationError::MissingRouteHints));
}
@@ -262,12 +256,9 @@ where
/// * Select one hint from each node, up to three hints or until we run out of hints.
///
/// [`PhantomKeysManager`]: crate::sign::PhantomKeysManager
-fn select_phantom_hints<L: Deref>(
+fn select_phantom_hints<L: Logger>(
amt_msat: Option<u64>, phantom_route_hints: Vec<PhantomRouteHints>, logger: L,
-) -> impl Iterator<Item = RouteHint>
-where
- L::Target: Logger,
-{
+) -> impl Iterator<Item = RouteHint> {
let mut phantom_hints: Vec<_> = Vec::new();
for PhantomRouteHints { channels, phantom_scid, real_node_pubkey } in phantom_route_hints {
@@ -363,12 +354,9 @@ fn rotate_through_iterators<T, I: Iterator<Item = T>>(mut vecs: Vec<I>) -> impl
/// * Limited to a total of 3 channels.
/// * Sorted by lowest inbound capacity if an online channel with the minimum amount requested exists,
/// otherwise sort by highest inbound capacity to give the payment the best chance of succeeding.
-pub(super) fn sort_and_filter_channels<L: Deref>(
+pub(super) fn sort_and_filter_channels<L: Logger>(
channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Option<u64>, logger: &L,
-) -> impl ExactSizeIterator<Item = RouteHint>
-where
- L::Target: Logger,
-{
+) -> impl ExactSizeIterator<Item = RouteHint> {
let mut filtered_channels: BTreeMap<PublicKey, ChannelDetails> = BTreeMap::new();
let min_inbound_capacity = min_inbound_capacity_msat.unwrap_or(0);
let mut min_capacity_channel_exists = false;
@@ -574,20 +562,14 @@ fn prefer_current_channel(
}
/// Adds relevant context to a [`Record`] before passing it to the wrapped [`Logger`].
-struct WithChannelDetails<'a, 'b, L: Deref>
-where
- L::Target: Logger,
-{
+struct WithChannelDetails<'a, 'b, L: Logger> {
/// The logger to delegate to after adding context to the record.
logger: &'a L,
/// The [`ChannelDetails`] for adding relevant context to the logged record.
details: &'b ChannelDetails,
}
-impl<'a, 'b, L: Deref> Logger for WithChannelDetails<'a, 'b, L>
-where
- L::Target: Logger,
-{
+impl<'a, 'b, L: Logger> Logger for WithChannelDetails<'a, 'b, L> {
fn log(&self, mut record: Record) {
record.peer_id = Some(self.details.counterparty.node_id);
record.channel_id = Some(self.details.channel_id);
@@ -595,10 +577,7 @@ where
}
}
-impl<'a, 'b, L: Deref> WithChannelDetails<'a, 'b, L>
-where
- L::Target: Logger,
-{
+impl<'a, 'b, L: Logger> WithChannelDetails<'a, 'b, L> {
fn from(logger: &'a L, details: &'b ChannelDetails) -> Self {
Self { logger, details }
}
diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs
index ed0de39..fd328e0 100644
--- a/lightning/src/ln/onion_payment.rs
+++ b/lightning/src/ln/onion_payment.rs
@@ -26,8 +26,6 @@ use crate::util::logger::Logger;
#[allow(unused_imports)]
use crate::prelude::*;
-use core::ops::Deref;
-
/// Invalid inbound onion payment.
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct InboundHTLCErr {
@@ -487,15 +485,12 @@ pub(super) fn create_recv_pending_htlc_info(
///
/// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
#[rustfmt::skip]
-pub fn peel_payment_onion<NS: NodeSigner, L: Deref, T: secp256k1::Verification>(
+pub fn peel_payment_onion<NS: NodeSigner, L: Logger, T: secp256k1::Verification>(
msg: &msgs::UpdateAddHTLC, node_signer: NS, logger: L, secp_ctx: &Secp256k1<T>,
cur_height: u32, allow_skimmed_fees: bool,
-) -> Result<PendingHTLCInfo, InboundHTLCErr>
-where
- L::Target: Logger,
-{
+) -> Result<PendingHTLCInfo, InboundHTLCErr> {
let (hop, next_packet_details_opt) =
- decode_incoming_update_add_htlc_onion(msg, &node_signer, &*logger, secp_ctx
+ decode_incoming_update_add_htlc_onion(msg, &node_signer, &logger, secp_ctx
).map_err(|(msg, failure_reason)| {
let (reason, err_data) = match msg {
HTLCFailureMsg::Malformed(_) => (failure_reason, Vec::new()),
@@ -585,12 +580,9 @@ pub(super) struct NextPacketDetails {
}
#[rustfmt::skip]
-pub(super) fn decode_incoming_update_add_htlc_onion<NS: NodeSigner, L: Deref, T: secp256k1::Verification>(
+pub(super) fn decode_incoming_update_add_htlc_onion<NS: NodeSigner, L: Logger, T: secp256k1::Verification>(
msg: &msgs::UpdateAddHTLC, node_signer: NS, logger: L, secp_ctx: &Secp256k1<T>,
-) -> Result<(onion_utils::Hop, Option<NextPacketDetails>), (HTLCFailureMsg, LocalHTLCFailureReason)>
-where
- L::Target: Logger,
-{
+) -> Result<(onion_utils::Hop, Option<NextPacketDetails>), (HTLCFailureMsg, LocalHTLCFailureReason)> {
let encode_malformed_error = |message: &str, failure_reason: LocalHTLCFailureReason| {
log_info!(logger, "Failed to accept/forward incoming HTLC: {}", message);
let (sha256_of_onion, failure_reason) = if msg.blinding_point.is_some() || failure_reason == LocalHTLCFailureReason::InvalidOnionBlinding {
diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs
index 63d92fd..fcfac7c 100644
--- a/lightning/src/ln/onion_utils.rs
+++ b/lightning/src/ln/onion_utils.rs
@@ -40,7 +40,6 @@ use bitcoin::secp256k1::ecdh::SharedSecret;
use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey};
use crate::io::{Cursor, Read};
-use core::ops::Deref;
#[allow(unused_imports)]
use crate::prelude::*;
@@ -983,13 +982,10 @@ mod fuzzy_onion_utils {
pub(crate) attribution_failed_channel: Option<u64>,
}
- pub fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
+ pub fn process_onion_failure<T: secp256k1::Signing, L: Logger>(
secp_ctx: &Secp256k1<T>, logger: &L, htlc_source: &HTLCSource,
encrypted_packet: OnionErrorPacket,
- ) -> DecodedOnionFailure
- where
- L::Target: Logger,
- {
+ ) -> DecodedOnionFailure {
let (path, session_priv) = match htlc_source {
HTLCSource::OutboundRoute { ref path, ref session_priv, .. } => (path, session_priv),
_ => unreachable!(),
@@ -999,13 +995,10 @@ mod fuzzy_onion_utils {
}
/// Decodes the attribution data that we got back from upstream on a payment we sent.
- pub fn decode_fulfill_attribution_data<T: secp256k1::Signing, L: Deref>(
+ pub fn decode_fulfill_attribution_data<T: secp256k1::Signing, L: Logger>(
secp_ctx: &Secp256k1<T>, logger: &L, path: &Path, outer_session_priv: &SecretKey,
mut attribution_data: AttributionData,
- ) -> Vec<u32>
- where
- L::Target: Logger,
- {
+ ) -> Vec<u32> {
let mut hold_times = Vec::new();
// Only consider hops in the regular path for attribution data. Blinded path attribution data isn't accessible.
@@ -1057,13 +1050,10 @@ pub(crate) use self::fuzzy_onion_utils::*;
/// Process failure we got back from upstream on a payment we sent (implying htlc_source is an
/// OutboundRoute).
-fn process_onion_failure_inner<T: secp256k1::Signing, L: Deref>(
+fn process_onion_failure_inner<T: secp256k1::Signing, L: Logger>(
secp_ctx: &Secp256k1<T>, logger: &L, path: &Path, session_priv: &SecretKey,
trampoline_session_priv_override: Option<SecretKey>, mut encrypted_packet: OnionErrorPacket,
-) -> DecodedOnionFailure
-where
- L::Target: Logger,
-{
+) -> DecodedOnionFailure {
// Check that there is at least enough data for an hmac, otherwise none of the checking that we may do makes sense.
// Also prevent slice out of bounds further down.
if encrypted_packet.data.len() < 32 {
@@ -2124,12 +2114,9 @@ impl HTLCFailReason {
}
}
- pub(super) fn decode_onion_failure<T: secp256k1::Signing, L: Deref>(
+ pub(super) fn decode_onion_failure<T: secp256k1::Signing, L: Logger>(
&self, secp_ctx: &Secp256k1<T>, logger: &L, htlc_source: &HTLCSource,
- ) -> DecodedOnionFailure
- where
- L::Target: Logger,
- {
+ ) -> DecodedOnionFailure {
match self.0 {
HTLCFailReasonRepr::LightningError { ref err, .. } => {
process_onion_failure(secp_ctx, logger, &htlc_source, err.clone())
diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs
index 0bc6103..d366f46 100644
--- a/lightning/src/ln/outbound_payment.rs
+++ b/lightning/src/ln/outbound_payment.rs
@@ -866,7 +866,7 @@ impl OutboundPayments {
impl OutboundPayments {
#[rustfmt::skip]
- pub(super) fn send_payment<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Deref>(
+ pub(super) fn send_payment<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Logger>(
&self, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields, payment_id: PaymentId,
retry_strategy: Retry, route_params: RouteParameters, router: &R,
first_hops: Vec<ChannelDetails>, compute_inflight_htlcs: IH, entropy_source: &ES,
@@ -877,7 +877,6 @@ impl OutboundPayments {
where
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
self.send_payment_for_non_bolt12_invoice(payment_id, payment_hash, recipient_onion, None, retry_strategy,
route_params, router, first_hops, &compute_inflight_htlcs, entropy_source, node_signer,
@@ -885,7 +884,7 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- pub(super) fn send_spontaneous_payment<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Deref>(
+ pub(super) fn send_spontaneous_payment<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Logger>(
&self, payment_preimage: Option<PaymentPreimage>, recipient_onion: RecipientOnionFields,
payment_id: PaymentId, retry_strategy: Retry, route_params: RouteParameters, router: &R,
first_hops: Vec<ChannelDetails>, inflight_htlcs: IH, entropy_source: &ES,
@@ -896,7 +895,6 @@ impl OutboundPayments {
where
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
let preimage = payment_preimage
.unwrap_or_else(|| PaymentPreimage(entropy_source.get_secure_random_bytes()));
@@ -909,7 +907,7 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- pub(super) fn pay_for_bolt11_invoice<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Deref>(
+ pub(super) fn pay_for_bolt11_invoice<R: Router, ES: EntropySource, NS: NodeSigner, IH, SP, L: Logger>(
&self, invoice: &Bolt11Invoice, payment_id: PaymentId,
amount_msats: Option<u64>,
route_params_config: RouteParametersConfig,
@@ -923,7 +921,6 @@ impl OutboundPayments {
where
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
let payment_hash = invoice.payment_hash();
@@ -955,7 +952,7 @@ impl OutboundPayments {
#[rustfmt::skip]
pub(super) fn send_payment_for_bolt12_invoice<
- R: Router, ES: EntropySource, NS: NodeSigner, NL: Deref, IH, SP, L: Deref,
+ R: Router, ES: EntropySource, NS: NodeSigner, NL: Deref, IH, SP, L: Logger,
>(
&self, invoice: &Bolt12Invoice, payment_id: PaymentId, router: &R,
first_hops: Vec<ChannelDetails>, features: Bolt12InvoiceFeatures, inflight_htlcs: IH,
@@ -968,7 +965,6 @@ impl OutboundPayments {
NL::Target: NodeIdLookUp,
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
let (payment_hash, retry_strategy, params_config, _) = self
@@ -998,7 +994,7 @@ impl OutboundPayments {
#[rustfmt::skip]
fn send_payment_for_bolt12_invoice_internal<
- R: Router, ES: EntropySource, NS: NodeSigner, NL: Deref, IH, SP, L: Deref,
+ R: Router, ES: EntropySource, NS: NodeSigner, NL: Deref, IH, SP, L: Logger,
>(
&self, payment_id: PaymentId, payment_hash: PaymentHash,
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>,
@@ -1013,7 +1009,6 @@ impl OutboundPayments {
NL::Target: NodeIdLookUp,
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
// Advance any blinded path where the introduction node is our node.
if let Ok(our_node_id) = node_signer.get_node_id(Recipient::Node) {
@@ -1217,7 +1212,7 @@ impl OutboundPayments {
NL: Deref,
IH,
SP,
- L: Deref,
+ L: Logger,
>(
&self, payment_id: PaymentId, hold_htlcs_at_next_hop: bool, router: &R,
first_hops: Vec<ChannelDetails>, inflight_htlcs: IH, entropy_source: &ES, node_signer: &NS,
@@ -1229,7 +1224,6 @@ impl OutboundPayments {
NL::Target: NodeIdLookUp,
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
let (
payment_hash,
@@ -1300,7 +1294,7 @@ impl OutboundPayments {
SP,
IH,
FH,
- L: Deref,
+ L: Logger,
>(
&self, router: &R, first_hops: FH, inflight_htlcs: IH, entropy_source: &ES,
node_signer: &NS, best_block_height: u32,
@@ -1311,7 +1305,6 @@ impl OutboundPayments {
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
IH: Fn() -> InFlightHtlcs,
FH: Fn() -> Vec<ChannelDetails>,
- L::Target: Logger,
{
let _single_thread = self.retry_lock.lock().unwrap();
let mut should_persist = false;
@@ -1410,14 +1403,13 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- fn find_initial_route<R: Router, NS: NodeSigner, IH, L: Deref>(
+ fn find_initial_route<R: Router, NS: NodeSigner, IH, L: Logger>(
&self, payment_id: PaymentId, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>,
route_params: &mut RouteParameters, router: &R, first_hops: &Vec<ChannelDetails>,
inflight_htlcs: &IH, node_signer: &NS, best_block_height: u32, logger: &WithContext<L>,
) -> Result<Route, RetryableSendFailure>
where
- L::Target: Logger,
IH: Fn() -> InFlightHtlcs,
{
#[cfg(feature = "std")] {
@@ -1463,7 +1455,7 @@ impl OutboundPayments {
/// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
/// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
#[rustfmt::skip]
- fn send_payment_for_non_bolt12_invoice<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Deref>(
+ fn send_payment_for_non_bolt12_invoice<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Logger>(
&self, payment_id: PaymentId, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
keysend_preimage: Option<PaymentPreimage>, retry_strategy: Retry, mut route_params: RouteParameters,
router: &R, first_hops: Vec<ChannelDetails>, inflight_htlcs: IH, entropy_source: &ES,
@@ -1472,7 +1464,6 @@ impl OutboundPayments {
logger: &WithContext<L>,
) -> Result<(), RetryableSendFailure>
where
- L::Target: Logger,
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
{
@@ -1506,7 +1497,7 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- fn find_route_and_send_payment<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Deref>(
+ fn find_route_and_send_payment<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Logger>(
&self, payment_hash: PaymentHash, payment_id: PaymentId, route_params: RouteParameters,
router: &R, first_hops: Vec<ChannelDetails>, inflight_htlcs: &IH, entropy_source: &ES,
node_signer: &NS, best_block_height: u32,
@@ -1514,7 +1505,6 @@ impl OutboundPayments {
send_payment_along_path: &SP, logger: &WithContext<L>,
)
where
- L::Target: Logger,
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
{
@@ -1665,7 +1655,7 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- fn handle_pay_route_err<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Deref>(
+ fn handle_pay_route_err<R: Router, NS: NodeSigner, ES: EntropySource, IH, SP, L: Logger>(
&self, err: PaymentSendFailure, payment_id: PaymentId, payment_hash: PaymentHash, route: Route,
mut route_params: RouteParameters, onion_session_privs: Vec<[u8; 32]>, router: &R,
first_hops: Vec<ChannelDetails>, inflight_htlcs: &IH, entropy_source: &ES, node_signer: &NS,
@@ -1676,7 +1666,6 @@ impl OutboundPayments {
where
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
- L::Target: Logger,
{
match err {
PaymentSendFailure::AllFailedResendSafe(errs) => {
@@ -1726,15 +1715,13 @@ impl OutboundPayments {
fn push_path_failed_evs_and_scids<
I: ExactSizeIterator + Iterator<Item = Result<(), APIError>>,
- L: Deref,
+ L: Logger,
>(
payment_id: PaymentId, payment_hash: PaymentHash, route_params: &mut RouteParameters,
paths: Vec<Path>, path_results: I,
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
logger: &WithContext<L>,
- ) where
- L::Target: Logger,
- {
+ ) {
let mut events = pending_events.lock().unwrap();
debug_assert_eq!(paths.len(), path_results.len());
for (path, path_res) in paths.into_iter().zip(path_results) {
@@ -2201,14 +2188,13 @@ impl OutboundPayments {
}
#[rustfmt::skip]
- pub(super) fn claim_htlc<L: Deref>(
+ pub(super) fn claim_htlc<L: Logger>(
&self, payment_id: PaymentId, payment_preimage: PaymentPreimage, bolt12_invoice: Option<PaidBolt12Invoice>,
session_priv: SecretKey, path: Path, from_onchain: bool, ev_completion_action: &mut Option<EventCompletionAction>,
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
logger: &WithContext<L>,
)
where
- L::Target: Logger,
{
let mut session_priv_bytes = [0; 32];
session_priv_bytes.copy_from_slice(&session_priv[..]);
@@ -2367,15 +2353,13 @@ impl OutboundPayments {
});
}
- pub(super) fn fail_htlc<L: Deref>(
+ pub(super) fn fail_htlc<L: Logger>(
&self, source: &HTLCSource, payment_hash: &PaymentHash, onion_error: &HTLCFailReason,
path: &Path, session_priv: &SecretKey, payment_id: &PaymentId,
probing_cookie_secret: [u8; 32], secp_ctx: &Secp256k1<secp256k1::All>,
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
completion_action: &mut Option<PaymentCompleteUpdate>, logger: &WithContext<L>,
- ) where
- L::Target: Logger,
- {
+ ) {
#[cfg(any(test, feature = "_test_utils"))]
let DecodedOnionFailure {
network_update,
@@ -2604,12 +2588,10 @@ impl OutboundPayments {
invoice_requests
}
- pub(super) fn insert_from_monitor_on_startup<L: Deref>(
+ pub(super) fn insert_from_monitor_on_startup<L: Logger>(
&self, payment_id: PaymentId, payment_hash: PaymentHash, session_priv_bytes: [u8; 32],
path: &Path, best_block_height: u32, logger: &WithContext<L>,
- ) where
- L::Target: Logger,
- {
+ ) {
let path_amt = path.final_value_msat();
let path_fee = path.fee_msat();
diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs
index c2bb0af..1891c52 100644
--- a/lightning/src/ln/peer_handler.rs
+++ b/lightning/src/ln/peer_handler.rs
@@ -977,8 +977,7 @@ pub trait APeerManager {
type RM: Deref<Target = Self::RMT>;
type OMT: OnionMessageHandler + ?Sized;
type OM: Deref<Target = Self::OMT>;
- type LT: Logger + ?Sized;
- type L: Deref<Target = Self::LT>;
+ type Logger: Logger;
type CMHT: CustomMessageHandler + ?Sized;
type CMH: Deref<Target = Self::CMHT>;
type NodeSigner: NodeSigner;
@@ -992,7 +991,7 @@ pub trait APeerManager {
Self::CM,
Self::RM,
Self::OM,
- Self::L,
+ Self::Logger,
Self::CMH,
Self::NodeSigner,
Self::SM,
@@ -1004,7 +1003,7 @@ impl<
CM: Deref,
RM: Deref,
OM: Deref,
- L: Deref,
+ L: Logger,
CMH: Deref,
NS: NodeSigner,
SM: Deref,
@@ -1013,7 +1012,6 @@ where
CM::Target: ChannelMessageHandler,
RM::Target: RoutingMessageHandler,
OM::Target: OnionMessageHandler,
- L::Target: Logger,
CMH::Target: CustomMessageHandler,
SM::Target: SendOnlyMessageHandler,
{
@@ -1024,8 +1022,7 @@ where
type RM = RM;
type OMT = <OM as Deref>::Target;
type OM = OM;
- type LT = <L as Deref>::Target;
- type L = L;
+ type Logger = L;
type CMHT = <CMH as Deref>::Target;
type CMH = CMH;
type NodeSigner = NS;
@@ -1060,7 +1057,7 @@ pub struct PeerManager<
CM: Deref,
RM: Deref,
OM: Deref,
- L: Deref,
+ L: Logger,
CMH: Deref,
NS: NodeSigner,
SM: Deref,
@@ -1068,7 +1065,6 @@ pub struct PeerManager<
CM::Target: ChannelMessageHandler,
RM::Target: RoutingMessageHandler,
OM::Target: OnionMessageHandler,
- L::Target: Logger,
CMH::Target: CustomMessageHandler,
SM::Target: SendOnlyMessageHandler,
{
@@ -1147,12 +1143,11 @@ fn encode_message<T: wire::Type>(message: wire::Message<T>) -> Vec<u8> {
buffer.0
}
-impl<Descriptor: SocketDescriptor, CM: Deref, OM: Deref, L: Deref, NS: NodeSigner, SM: Deref>
+impl<Descriptor: SocketDescriptor, CM: Deref, OM: Deref, L: Logger, NS: NodeSigner, SM: Deref>
PeerManager<Descriptor, CM, IgnoringMessageHandler, OM, L, IgnoringMessageHandler, NS, SM>
where
CM::Target: ChannelMessageHandler,
OM::Target: OnionMessageHandler,
- L::Target: Logger,
SM::Target: SendOnlyMessageHandler,
{
/// Constructs a new `PeerManager` with the given `ChannelMessageHandler` and
@@ -1189,7 +1184,7 @@ where
}
}
-impl<Descriptor: SocketDescriptor, RM: Deref, L: Deref, NS: NodeSigner>
+impl<Descriptor: SocketDescriptor, RM: Deref, L: Logger, NS: NodeSigner>
PeerManager<
Descriptor,
ErroringMessageHandler,
@@ -1201,7 +1196,6 @@ impl<Descriptor: SocketDescriptor, RM: Deref, L: Deref, NS: NodeSigner>
IgnoringMessageHandler,
> where
RM::Target: RoutingMessageHandler,
- L::Target: Logger,
{
/// Constructs a new `PeerManager` with the given `RoutingMessageHandler`. No channel message
/// handler or onion message handler is used and onion and channel messages will be ignored (or
@@ -1290,7 +1284,7 @@ impl<
CM: Deref,
RM: Deref,
OM: Deref,
- L: Deref,
+ L: Logger,
CMH: Deref,
NS: NodeSigner,
SM: Deref,
@@ -1299,7 +1293,6 @@ where
CM::Target: ChannelMessageHandler,
RM::Target: RoutingMessageHandler,
OM::Target: OnionMessageHandler,
- L::Target: Logger,
CMH::Target: CustomMessageHandler,
SM::Target: SendOnlyMessageHandler,
{
diff --git a/lightning/src/offers/flow.rs b/lightning/src/offers/flow.rs
index 3ee57c5..0bb9877 100644
--- a/lightning/src/offers/flow.rs
+++ b/lightning/src/offers/flow.rs
@@ -10,7 +10,6 @@
//! Provides data structures and functions for creating and managing Offers messages,
//! facilitating communication, and handling BOLT12 messages and payments.
-use core::ops::Deref;
use core::sync::atomic::{AtomicUsize, Ordering};
use core::time::Duration;
@@ -74,10 +73,7 @@ use {
///
/// [`OffersMessageFlow`] is parameterized by a [`MessageRouter`], which is responsible
/// for finding message paths when initiating and retrying onion messages.
-pub struct OffersMessageFlow<MR: MessageRouter, L: Deref>
-where
- L::Target: Logger,
-{
+pub struct OffersMessageFlow<MR: MessageRouter, L: Logger> {
chain_hash: ChainHash,
best_block: RwLock<BestBlock>,
@@ -106,10 +102,7 @@ where
logger: L,
}
-impl<MR: MessageRouter, L: Deref> OffersMessageFlow<MR, L>
-where
- L::Target: Logger,
-{
+impl<MR: MessageRouter, L: Logger> OffersMessageFlow<MR, L> {
/// Creates a new [`OffersMessageFlow`]
pub fn new(
chain_hash: ChainHash, best_block: BestBlock, our_network_pubkey: PublicKey,
@@ -264,10 +257,7 @@ const DEFAULT_ASYNC_RECEIVE_OFFER_EXPIRY: Duration = Duration::from_secs(365 * 2
pub(crate) const TEST_DEFAULT_ASYNC_RECEIVE_OFFER_EXPIRY: Duration =
DEFAULT_ASYNC_RECEIVE_OFFER_EXPIRY;
-impl<MR: MessageRouter, L: Deref> OffersMessageFlow<MR, L>
-where
- L::Target: Logger,
-{
+impl<MR: MessageRouter, L: Logger> OffersMessageFlow<MR, L> {
/// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
/// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
///
@@ -427,10 +417,7 @@ pub enum HeldHtlcReplyPath {
},
}
-impl<MR: MessageRouter, L: Deref> OffersMessageFlow<MR, L>
-where
- L::Target: Logger,
-{
+impl<MR: MessageRouter, L: Logger> OffersMessageFlow<MR, L> {
/// Verifies an [`InvoiceRequest`] using the provided [`OffersContext`] or the [`InvoiceRequest::metadata`].
///
/// - If an [`OffersContext::InvoiceRequest`] with a `nonce` is provided, verification is performed using recipient context data.
diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs
index 525d3a7..0aadc6d 100644
--- a/lightning/src/onion_message/messenger.rs
+++ b/lightning/src/onion_message/messenger.rs
@@ -70,9 +70,7 @@ pub trait AOnionMessenger {
/// A type implementing [`NodeSigner`]
type NodeSigner: NodeSigner;
/// A type implementing [`Logger`]
- type Logger: Logger + ?Sized;
- /// A type that may be dereferenced to [`Self::Logger`]
- type L: Deref<Target = Self::Logger>;
+ type Logger: Logger;
/// A type implementing [`NodeIdLookUp`]
type NodeIdLookUp: NodeIdLookUp + ?Sized;
/// A type that may be dereferenced to [`Self::NodeIdLookUp`]
@@ -101,7 +99,7 @@ pub trait AOnionMessenger {
) -> &OnionMessenger<
Self::EntropySource,
Self::NodeSigner,
- Self::L,
+ Self::Logger,
Self::NL,
Self::MessageRouter,
Self::OMH,
@@ -114,7 +112,7 @@ pub trait AOnionMessenger {
impl<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -123,7 +121,6 @@ impl<
CMH: Deref,
> AOnionMessenger for OnionMessenger<ES, NS, L, NL, MR, OMH, APH, DRH, CMH>
where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
@@ -132,8 +129,7 @@ where
{
type EntropySource = ES;
type NodeSigner = NS;
- type Logger = L::Target;
- type L = L;
+ type Logger = L;
type NodeIdLookUp = NL::Target;
type NL = NL;
type MessageRouter = MR;
@@ -274,7 +270,7 @@ where
pub struct OnionMessenger<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -282,7 +278,6 @@ pub struct OnionMessenger<
DRH: Deref,
CMH: Deref,
> where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
@@ -555,10 +550,7 @@ impl<T: MessageRouter + ?Sized, R: Deref<Target = T>> MessageRouter for R {
/// node. Otherwise, there is no way to find a path to the introduction node in order to send a
/// message, and thus an `Err` is returned. The impact of this may be somewhat muted when
/// additional dummy hops are added to the blinded path, but this protection is not complete.
-pub struct DefaultMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource>
-where
- L::Target: Logger,
-{
+pub struct DefaultMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource> {
network_graph: G,
entropy_source: ES,
}
@@ -574,9 +566,8 @@ pub(crate) const DUMMY_HOPS_PATH_LENGTH: usize = 4;
// We add dummy hops until the path reaches this length (including the recipient).
pub(crate) const QR_CODED_DUMMY_HOPS_PATH_LENGTH: usize = 2;
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource> DefaultMessageRouter<G, L, ES>
-where
- L::Target: Logger,
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource>
+ DefaultMessageRouter<G, L, ES>
{
/// Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`].
pub fn new(network_graph: G, entropy_source: ES) -> Self {
@@ -742,10 +733,8 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource> MessageRouter
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource> MessageRouter
for DefaultMessageRouter<G, L, ES>
-where
- L::Target: Logger,
{
fn find_path(
&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination,
@@ -787,17 +776,13 @@ where
/// node. Otherwise, there is no way to find a path to the introduction node in order to send a
/// message, and thus an `Err` is returned. The impact of this may be somewhat muted when
/// additional dummy hops are added to the blinded path, but this protection is not complete.
-pub struct NodeIdMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource>
-where
- L::Target: Logger,
-{
+pub struct NodeIdMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource> {
network_graph: G,
entropy_source: ES,
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource> NodeIdMessageRouter<G, L, ES>
-where
- L::Target: Logger,
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource>
+ NodeIdMessageRouter<G, L, ES>
{
/// Creates a [`NodeIdMessageRouter`] using the given [`NetworkGraph`].
pub fn new(network_graph: G, entropy_source: ES) -> Self {
@@ -805,10 +790,8 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: EntropySource> MessageRouter
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger, ES: EntropySource> MessageRouter
for NodeIdMessageRouter<G, L, ES>
-where
- L::Target: Logger,
{
fn find_path(
&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination,
@@ -1167,12 +1150,11 @@ where
///
/// Returns either the next layer of the onion for forwarding or the decrypted content for the
/// receiver.
-pub fn peel_onion_message<NS: NodeSigner, L: Deref, CMH: Deref>(
+pub fn peel_onion_message<NS: NodeSigner, L: Logger, CMH: Deref>(
msg: &OnionMessage, secp_ctx: &Secp256k1<secp256k1::All>, node_signer: NS, logger: L,
custom_handler: CMH,
) -> Result<PeeledOnion<<<CMH>::Target as CustomOnionMessageHandler>::CustomMessage>, ()>
where
- L::Target: Logger,
CMH::Target: CustomOnionMessageHandler,
{
let control_tlvs_ss = match node_signer.ecdh(Recipient::Node, &msg.blinding_point, None) {
@@ -1203,7 +1185,7 @@ where
onion_decode_ss,
&msg.onion_routing_packet.hop_data[..],
msg.onion_routing_packet.hmac,
- (control_tlvs_ss, custom_handler.deref(), receiving_context_auth_key, logger.deref()),
+ (control_tlvs_ss, custom_handler.deref(), receiving_context_auth_key, &logger),
);
// Constructs the next onion message using packet data and blinding logic.
@@ -1391,7 +1373,7 @@ macro_rules! drop_handled_events_and_abort {
impl<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -1400,7 +1382,6 @@ impl<
CMH: Deref,
> OnionMessenger<ES, NS, L, NL, MR, OMH, APH, DRH, CMH>
where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
@@ -1801,7 +1782,7 @@ where
msg,
&self.secp_ctx,
&self.node_signer,
- &*self.logger,
+ &self.logger,
&*self.custom_handler,
)
}
@@ -2032,7 +2013,7 @@ fn outbound_buffer_full(
impl<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -2041,7 +2022,6 @@ impl<
CMH: Deref,
> EventsProvider for OnionMessenger<ES, NS, L, NL, MR, OMH, APH, DRH, CMH>
where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
@@ -2150,7 +2130,7 @@ where
impl<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -2159,7 +2139,6 @@ impl<
CMH: Deref,
> BaseMessageHandler for OnionMessenger<ES, NS, L, NL, MR, OMH, APH, DRH, CMH>
where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
@@ -2219,7 +2198,7 @@ where
impl<
ES: EntropySource,
NS: NodeSigner,
- L: Deref,
+ L: Logger,
NL: Deref,
MR: MessageRouter,
OMH: Deref,
@@ -2228,7 +2207,6 @@ impl<
CMH: Deref,
> OnionMessageHandler for OnionMessenger<ES, NS, L, NL, MR, OMH, APH, DRH, CMH>
where
- L::Target: Logger,
NL::Target: NodeIdLookUp,
OMH::Target: OffersMessageHandler,
APH::Target: AsyncPaymentsMessageHandler,
diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs
index 534bebe..b3059e3 100644
--- a/lightning/src/routing/gossip.rs
+++ b/lightning/src/routing/gossip.rs
@@ -184,10 +184,7 @@ impl FromStr for NodeId {
}
/// Represents the network as nodes and channels between them
-pub struct NetworkGraph<L: Deref>
-where
- L::Target: Logger,
-{
+pub struct NetworkGraph<L: Logger> {
secp_ctx: Secp256k1<secp256k1::VerifyOnly>,
last_rapid_gossip_sync_timestamp: Mutex<Option<u32>>,
chain_hash: ChainHash,
@@ -322,10 +319,9 @@ impl MaybeReadable for NetworkUpdate {
/// This network graph is then used for routing payments.
/// Provides interface to help with initial routing sync by
/// serving historical announcements.
-pub struct P2PGossipSync<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref>
+pub struct P2PGossipSync<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Logger>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
network_graph: G,
#[cfg(any(feature = "_test_utils", test))]
@@ -337,10 +333,9 @@ where
logger: L,
}
-impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref> P2PGossipSync<G, U, L>
+impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Logger> P2PGossipSync<G, U, L>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
/// Creates a new tracker of the actual state of the network of channels and nodes,
/// assuming an existing [`NetworkGraph`].
@@ -426,10 +421,7 @@ where
}
}
-impl<L: Deref> NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> NetworkGraph<L> {
/// Handles any network updates originating from [`Event`]s.
///
/// [`Event`]: crate::events::Event
@@ -542,11 +534,10 @@ pub fn verify_channel_announcement<C: Verification>(
Ok(())
}
-impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref> RoutingMessageHandler
+impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Logger> RoutingMessageHandler
for P2PGossipSync<G, U, L>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
fn handle_node_announcement(
&self, _their_node_id: Option<PublicKey>, msg: &msgs::NodeAnnouncement,
@@ -770,11 +761,10 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref> BaseMessageHandler
+impl<G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Logger> BaseMessageHandler
for P2PGossipSync<G, U, L>
where
U::Target: UtxoLookup,
- L::Target: Logger,
{
/// Initiates a stateless sync of routing gossip information with a peer
/// using [`gossip_queries`]. The default strategy used by this implementation
@@ -1644,10 +1634,7 @@ impl Readable for NodeInfo {
const SERIALIZATION_VERSION: u8 = 1;
const MIN_SERIALIZATION_VERSION: u8 = 1;
-impl<L: Deref> Writeable for NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> Writeable for NetworkGraph<L> {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
self.test_node_counter_consistency();
@@ -1675,10 +1662,7 @@ where
}
}
-impl<L: Deref> ReadableArgs<L> for NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> ReadableArgs<L> for NetworkGraph<L> {
fn read<R: io::Read>(reader: &mut R, logger: L) -> Result<NetworkGraph<L>, DecodeError> {
let _ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
@@ -1745,10 +1729,7 @@ where
}
}
-impl<L: Deref> fmt::Display for NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> fmt::Display for NetworkGraph<L> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
writeln!(f, "Network map\n[Channels]")?;
for (key, val) in self.channels.read().unwrap().unordered_iter() {
@@ -1762,11 +1743,8 @@ where
}
}
-impl<L: Deref> Eq for NetworkGraph<L> where L::Target: Logger {}
-impl<L: Deref> PartialEq for NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> Eq for NetworkGraph<L> {}
+impl<L: Logger> PartialEq for NetworkGraph<L> {
fn eq(&self, other: &Self) -> bool {
// For a total lockorder, sort by position in memory and take the inner locks in that order.
// (Assumes that we can't move within memory while a lock is held).
@@ -1796,10 +1774,7 @@ const CHAN_COUNT_ESTIMATE: usize = 63_000;
/// too low.
const NODE_COUNT_ESTIMATE: usize = 20_000;
-impl<L: Deref> NetworkGraph<L>
-where
- L::Target: Logger,
-{
+impl<L: Logger> NetworkGraph<L> {
/// Creates a new, empty, network graph.
pub fn new(network: Network, logger: L) -> NetworkGraph<L> {
let (node_map_cap, chan_map_cap) = if matches!(network, Network::Bitcoin) {
diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs
index 0a23588..42d5694 100644
--- a/lightning/src/routing/router.rs
+++ b/lightning/src/routing/router.rs
@@ -57,13 +57,12 @@ pub use lightning_types::routing::{RouteHint, RouteHintHop};
/// payment, and thus an `Err` is returned.
pub struct DefaultRouter<
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
ES: EntropySource,
S: Deref,
SP: Sized,
Sc: ScoreLookUp<ScoreParams = SP>,
> where
- L::Target: Logger,
S::Target: for<'a> LockableScore<'a, ScoreLookUp = Sc>,
{
network_graph: G,
@@ -78,14 +77,13 @@ pub const DEFAULT_PAYMENT_DUMMY_HOPS: usize = 3;
impl<
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
ES: EntropySource,
S: Deref,
SP: Sized,
Sc: ScoreLookUp<ScoreParams = SP>,
> DefaultRouter<G, L, ES, S, SP, Sc>
where
- L::Target: Logger,
S::Target: for<'a> LockableScore<'a, ScoreLookUp = Sc>,
{
/// Creates a new router.
@@ -98,14 +96,13 @@ where
impl<
G: Deref<Target = NetworkGraph<L>>,
- L: Deref,
+ L: Logger,
ES: EntropySource,
S: Deref,
SP: Sized,
Sc: ScoreLookUp<ScoreParams = SP>,
> Router for DefaultRouter<G, L, ES, S, SP, Sc>
where
- L::Target: Logger,
S::Target: for<'a> LockableScore<'a, ScoreLookUp = Sc>,
{
#[rustfmt::skip]
@@ -118,7 +115,7 @@ where
) -> Result<Route, &'static str> {
let random_seed_bytes = self.entropy_source.get_secure_random_bytes();
find_route(
- payer, params, &self.network_graph, first_hops, &*self.logger,
+ payer, params, &self.network_graph, first_hops, &self.logger,
&ScorerAccountingForInFlightHtlcs::new(self.scorer.read_lock(), &inflight_htlcs),
&self.score_params,
&random_seed_bytes
@@ -1984,12 +1981,11 @@ impl<'a> NodeCounters<'a> {
/// Calculates the introduction point for each blinded path in the given [`PaymentParameters`], if
/// they can be found.
#[rustfmt::skip]
-fn calculate_blinded_path_intro_points<'a, L: Deref>(
+fn calculate_blinded_path_intro_points<'a, L: Logger>(
payment_params: &PaymentParameters, node_counters: &'a NodeCounters,
network_graph: &ReadOnlyNetworkGraph, logger: &L, our_node_id: NodeId,
first_hop_targets: &HashMap<NodeId, (Vec<&ChannelDetails>, u32)>,
-) -> Result<Vec<Option<(&'a NodeId, u32)>>, &'static str>
-where L::Target: Logger {
+) -> Result<Vec<Option<(&'a NodeId, u32)>>, &'static str> {
let introduction_node_id_cache = payment_params.payee.blinded_route_hints().iter()
.map(|path| {
match path.introduction_node() {
@@ -2490,12 +2486,11 @@ fn sort_first_hop_channels(
/// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
/// [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
#[rustfmt::skip]
-pub fn find_route<L: Deref, GL: Deref, S: ScoreLookUp>(
+pub fn find_route<L: Logger, GL: Logger, S: ScoreLookUp>(
our_node_pubkey: &PublicKey, route_params: &RouteParameters,
network_graph: &NetworkGraph<GL>, first_hops: Option<&[&ChannelDetails]>, logger: L,
scorer: &S, score_params: &S::ScoreParams, random_seed_bytes: &[u8; 32]
-) -> Result<Route, &'static str>
-where L::Target: Logger, GL::Target: Logger {
+) -> Result<Route, &'static str> {
let graph_lock = network_graph.read_only();
let mut route = get_route(our_node_pubkey, &route_params, &graph_lock, first_hops, logger,
scorer, score_params, random_seed_bytes)?;
@@ -2504,12 +2499,11 @@ where L::Target: Logger, GL::Target: Logger {
}
#[rustfmt::skip]
-pub(crate) fn get_route<L: Deref, S: ScoreLookUp>(
+pub(crate) fn get_route<L: Logger, S: ScoreLookUp>(
our_node_pubkey: &PublicKey, route_params: &RouteParameters, network_graph: &ReadOnlyNetworkGraph,
first_hops: Option<&[&ChannelDetails]>, logger: L, scorer: &S, score_params: &S::ScoreParams,
_random_seed_bytes: &[u8; 32]
-) -> Result<Route, &'static str>
-where L::Target: Logger {
+) -> Result<Route, &'static str> {
let payment_params = &route_params.payment_params;
let max_path_length = core::cmp::min(payment_params.max_path_length, MAX_PATH_LENGTH_ESTIMATE);
@@ -3893,11 +3887,10 @@ fn add_random_cltv_offset(route: &mut Route, payment_params: &PaymentParameters,
///
/// Re-uses logic from `find_route`, so the restrictions described there also apply here.
#[rustfmt::skip]
-pub fn build_route_from_hops<L: Deref, GL: Deref>(
+pub fn build_route_from_hops<L: Logger, GL: Logger>(
our_node_pubkey: &PublicKey, hops: &[PublicKey], route_params: &RouteParameters,
network_graph: &NetworkGraph<GL>, logger: L, random_seed_bytes: &[u8; 32]
-) -> Result<Route, &'static str>
-where L::Target: Logger, GL::Target: Logger {
+) -> Result<Route, &'static str> {
let graph_lock = network_graph.read_only();
let mut route = build_route_from_hops_internal(our_node_pubkey, hops, &route_params,
&graph_lock, logger, random_seed_bytes)?;
@@ -3906,10 +3899,10 @@ where L::Target: Logger, GL::Target: Logger {
}
#[rustfmt::skip]
-fn build_route_from_hops_internal<L: Deref>(
+fn build_route_from_hops_internal<L: Logger>(
our_node_pubkey: &PublicKey, hops: &[PublicKey], route_params: &RouteParameters,
network_graph: &ReadOnlyNetworkGraph, logger: L, random_seed_bytes: &[u8; 32],
-) -> Result<Route, &'static str> where L::Target: Logger {
+) -> Result<Route, &'static str> {
struct HopScorer {
our_node_id: NodeId,
diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs
index d741adf..47621e3 100644
--- a/lightning/src/routing/scoring.rs
+++ b/lightning/src/routing/scoring.rs
@@ -479,10 +479,7 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
/// [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_multiplier_msat
/// [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_amount_multiplier_msat
-pub struct ProbabilisticScorer<G: Deref<Target = NetworkGraph<L>>, L: Deref>
-where
- L::Target: Logger,
-{
+pub struct ProbabilisticScorer<G: Deref<Target = NetworkGraph<L>>, L: Logger> {
decay_params: ProbabilisticScoringDecayParameters,
network_graph: G,
logger: L,
@@ -964,10 +961,7 @@ struct DirectedChannelLiquidity<
last_datapoint_time: T,
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ProbabilisticScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> ProbabilisticScorer<G, L> {
/// Creates a new scorer using the given scoring parameters for sending payments from a node
/// through a network graph.
pub fn new(
@@ -1593,9 +1587,9 @@ impl<
{
/// Adjusts the channel liquidity balance bounds when failing to route `amount_msat`.
#[rustfmt::skip]
- fn failed_at_channel<Log: Deref>(
+ fn failed_at_channel<Log: Logger>(
&mut self, amount_msat: u64, duration_since_epoch: Duration, chan_descr: fmt::Arguments, logger: &Log
- ) where Log::Target: Logger {
+ ) {
let existing_max_msat = self.max_liquidity_msat();
if amount_msat < existing_max_msat {
log_debug!(logger, "Setting max liquidity of {} from {} to {}", chan_descr, existing_max_msat, amount_msat);
@@ -1610,9 +1604,9 @@ impl<
/// Adjusts the channel liquidity balance bounds when failing to route `amount_msat` downstream.
#[rustfmt::skip]
- fn failed_downstream<Log: Deref>(
+ fn failed_downstream<Log: Logger>(
&mut self, amount_msat: u64, duration_since_epoch: Duration, chan_descr: fmt::Arguments, logger: &Log
- ) where Log::Target: Logger {
+ ) {
let existing_min_msat = self.min_liquidity_msat();
if amount_msat > existing_min_msat {
log_debug!(logger, "Setting min liquidity of {} from {} to {}", existing_min_msat, chan_descr, amount_msat);
@@ -1627,9 +1621,9 @@ impl<
/// Adjusts the channel liquidity balance bounds when successfully routing `amount_msat`.
#[rustfmt::skip]
- fn successful<Log: Deref>(&mut self,
+ fn successful<Log: Logger>(&mut self,
amount_msat: u64, duration_since_epoch: Duration, chan_descr: fmt::Arguments, logger: &Log
- ) where Log::Target: Logger {
+ ) {
let max_liquidity_msat = self.max_liquidity_msat().checked_sub(amount_msat).unwrap_or(0);
log_debug!(logger, "Subtracting {} from max liquidity of {} (setting it to {})", amount_msat, chan_descr, max_liquidity_msat);
self.set_max_liquidity_msat(max_liquidity_msat, duration_since_epoch);
@@ -1669,10 +1663,7 @@ impl<
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for ProbabilisticScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> ScoreLookUp for ProbabilisticScorer<G, L> {
type ScoreParams = ProbabilisticScoringFeeParameters;
#[rustfmt::skip]
fn channel_penalty_msat(
@@ -1735,10 +1726,7 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for ProbabilisticScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> ScoreUpdate for ProbabilisticScorer<G, L> {
#[rustfmt::skip]
fn payment_path_failed(&mut self, path: &Path, short_channel_id: u64, duration_since_epoch: Duration) {
let amount_msat = path.final_value_msat();
@@ -1836,18 +1824,12 @@ where
///
/// Note that only the locally acquired data is persisted. After a restart, the external scores will be lost and must be
/// resupplied.
-pub struct CombinedScorer<G: Deref<Target = NetworkGraph<L>>, L: Deref>
-where
- L::Target: Logger,
-{
+pub struct CombinedScorer<G: Deref<Target = NetworkGraph<L>>, L: Logger> {
local_only_scorer: ProbabilisticScorer<G, L>,
scorer: ProbabilisticScorer<G, L>,
}
-impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref + Clone> CombinedScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Logger + Clone> CombinedScorer<G, L> {
/// Create a new combined scorer with the given local scorer.
#[rustfmt::skip]
pub fn new(local_scorer: ProbabilisticScorer<G, L>) -> Self {
@@ -1889,10 +1871,7 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for CombinedScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> ScoreLookUp for CombinedScorer<G, L> {
type ScoreParams = ProbabilisticScoringFeeParameters;
fn channel_penalty_msat(
@@ -1903,10 +1882,7 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for CombinedScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> ScoreUpdate for CombinedScorer<G, L> {
fn payment_path_failed(
&mut self, path: &Path, short_channel_id: u64, duration_since_epoch: Duration,
) {
@@ -1935,20 +1911,14 @@ where
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> Writeable for CombinedScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> Writeable for CombinedScorer<G, L> {
fn write<W: crate::util::ser::Writer>(&self, writer: &mut W) -> Result<(), crate::io::Error> {
self.local_only_scorer.write(writer)
}
}
#[cfg(c_bindings)]
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> Score for ProbabilisticScorer<G, L> where
- L::Target: Logger
-{
-}
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> Score for ProbabilisticScorer<G, L> {}
#[cfg(feature = "std")]
#[inline]
@@ -2520,20 +2490,15 @@ mod bucketed_history {
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> Writeable for ProbabilisticScorer<G, L>
-where
- L::Target: Logger,
-{
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger> Writeable for ProbabilisticScorer<G, L> {
#[inline]
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
self.channel_liquidities.write(w)
}
}
-impl<G: Deref<Target = NetworkGraph<L>>, L: Deref>
+impl<G: Deref<Target = NetworkGraph<L>>, L: Logger>
ReadableArgs<(ProbabilisticScoringDecayParameters, G, L)> for ProbabilisticScorer<G, L>
-where
- L::Target: Logger,
{
#[inline]
#[rustfmt::skip]
diff --git a/lightning/src/routing/utxo.rs b/lightning/src/routing/utxo.rs
index ab653b1..089c536 100644
--- a/lightning/src/routing/utxo.rs
+++ b/lightning/src/routing/utxo.rs
@@ -491,12 +491,10 @@ impl PendingChecks {
}
}
- fn resolve_single_future<L: Deref>(
+ fn resolve_single_future<L: Logger>(
&self, graph: &NetworkGraph<L>, entry: Arc<Mutex<UtxoMessages>>,
new_messages: &mut Vec<MessageSendEvent>,
- ) where
- L::Target: Logger,
- {
+ ) {
let (announcement, result, announce_a, announce_b, update_a, update_b);
{
let mut state = entry.lock().unwrap();
@@ -581,12 +579,9 @@ impl PendingChecks {
}
}
- pub(super) fn check_resolved_futures<L: Deref>(
+ pub(super) fn check_resolved_futures<L: Logger>(
&self, graph: &NetworkGraph<L>,
- ) -> Vec<MessageSendEvent>
- where
- L::Target: Logger,
- {
+ ) -> Vec<MessageSendEvent> {
let mut completed_states = Vec::new();
{
let mut lck = self.internal.lock().unwrap();
diff --git a/lightning/src/sign/tx_builder.rs b/lightning/src/sign/tx_builder.rs
index 74941ec..27b8b1a 100644
--- a/lightning/src/sign/tx_builder.rs
+++ b/lightning/src/sign/tx_builder.rs
@@ -2,7 +2,6 @@
#![allow(dead_code)]
use core::cmp;
-use core::ops::Deref;
use bitcoin::secp256k1::{self, PublicKey, Secp256k1};
@@ -169,14 +168,12 @@ pub(crate) trait TxBuilder {
&self, is_outbound_from_holder: bool, value_to_self_after_htlcs: u64,
value_to_remote_after_htlcs: u64, channel_type: &ChannelTypeFeatures,
) -> (u64, u64);
- fn build_commitment_transaction<L: Deref>(
+ fn build_commitment_transaction<L: Logger>(
&self, local: bool, commitment_number: u64, per_commitment_point: &PublicKey,
channel_parameters: &ChannelTransactionParameters, secp_ctx: &Secp256k1<secp256k1::All>,
value_to_self_msat: u64, htlcs_in_tx: Vec<HTLCOutputInCommitment>, feerate_per_kw: u32,
broadcaster_dust_limit_satoshis: u64, logger: &L,
- ) -> (CommitmentTransaction, CommitmentStats)
- where
- L::Target: Logger;
+ ) -> (CommitmentTransaction, CommitmentStats);
}
pub(crate) struct SpecTxBuilder {}
@@ -322,15 +319,12 @@ impl TxBuilder for SpecTxBuilder {
(local_balance_before_fee_msat, remote_balance_before_fee_msat)
}
- fn build_commitment_transaction<L: Deref>(
+ fn build_commitment_transaction<L: Logger>(
&self, local: bool, commitment_number: u64, per_commitment_point: &PublicKey,
channel_parameters: &ChannelTransactionParameters, secp_ctx: &Secp256k1<secp256k1::All>,
value_to_self_msat: u64, mut htlcs_in_tx: Vec<HTLCOutputInCommitment>, feerate_per_kw: u32,
broadcaster_dust_limit_satoshis: u64, logger: &L,
- ) -> (CommitmentTransaction, CommitmentStats)
- where
- L::Target: Logger,
- {
+ ) -> (CommitmentTransaction, CommitmentStats) {
let mut local_htlc_total_msat = 0;
let mut remote_htlc_total_msat = 0;
let channel_type = &channel_parameters.channel_type_features;
diff --git a/lightning/src/util/anchor_channel_reserves.rs b/lightning/src/util/anchor_channel_reserves.rs
index 92c5197..3e9945f 100644
--- a/lightning/src/util/anchor_channel_reserves.rs
+++ b/lightning/src/util/anchor_channel_reserves.rs
@@ -275,10 +275,10 @@ pub fn can_support_additional_anchor_channel<
FilterRef: Deref,
B: BroadcasterInterface,
FE: FeeEstimator,
- LoggerRef: Deref,
+ L: Logger,
PersistRef: Deref,
ES: EntropySource,
- ChainMonitorRef: Deref<Target = ChainMonitor<ChannelSigner, FilterRef, B, FE, LoggerRef, PersistRef, ES>>,
+ ChainMonitorRef: Deref<Target = ChainMonitor<ChannelSigner, FilterRef, B, FE, L, PersistRef, ES>>,
>(
context: &AnchorChannelReserveContext, utxos: &[Utxo], a_channel_manager: AChannelManagerRef,
chain_monitor: ChainMonitorRef,
@@ -286,7 +286,6 @@ pub fn can_support_additional_anchor_channel<
where
AChannelManagerRef::Target: AChannelManager,
FilterRef::Target: Filter,
- LoggerRef::Target: Logger,
PersistRef::Target: Persist<ChannelSigner>,
{
let mut anchor_channels = new_hash_set();
diff --git a/lightning/src/util/logger.rs b/lightning/src/util/logger.rs
index 0d2eb47..c8b6715 100644
--- a/lightning/src/util/logger.rs
+++ b/lightning/src/util/logger.rs
@@ -294,14 +294,17 @@ pub trait Logger {
fn log(&self, record: Record);
}
+impl<T: Logger + ?Sized, L: Deref<Target = T>> Logger for L {
+ fn log(&self, record: Record) {
+ self.deref().log(record)
+ }
+}
+
/// Adds relevant context to a [`Record`] before passing it to the wrapped [`Logger`].
///
/// This is not exported to bindings users as lifetimes are problematic and there's little reason
/// for this to be used downstream anyway.
-pub struct WithContext<'a, L: Deref>
-where
- L::Target: Logger,
-{
+pub struct WithContext<'a, L: Logger> {
logger: &'a L,
peer_id: Option<PublicKey>,
channel_id: Option<ChannelId>,
@@ -309,10 +312,7 @@ where
payment_id: Option<PaymentId>,
}
-impl<'a, L: Deref> Logger for WithContext<'a, L>
-where
- L::Target: Logger,
-{
+impl<'a, L: Logger> Logger for WithContext<'a, L> {
fn log(&self, mut record: Record) {
if self.peer_id.is_some() && record.peer_id.is_none() {
record.peer_id = self.peer_id
@@ -330,10 +330,7 @@ where
}
}
-impl<'a, L: Deref> WithContext<'a, L>
-where
- L::Target: Logger,
-{
+impl<'a, L: Logger> WithContext<'a, L> {
/// Wraps the given logger, providing additional context to any logged records.
pub fn from(
logger: &'a L, peer_id: Option<PublicKey>, channel_id: Option<ChannelId>,
diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs
index 3a94732..a71e634 100644
--- a/lightning/src/util/persist.rs
+++ b/lightning/src/util/persist.rs
@@ -589,7 +589,7 @@ fn poll_sync_future<F: Future>(future: F) -> F::Output {
/// [`MonitorUpdatingPersister::cleanup_stale_updates`] function.
pub struct MonitorUpdatingPersister<
K: Deref,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -597,12 +597,11 @@ pub struct MonitorUpdatingPersister<
>(MonitorUpdatingPersisterAsync<KVStoreSyncWrapper<K>, PanicingSpawner, L, ES, SP, BI, FE>)
where
K::Target: KVStoreSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized;
impl<
K: Deref,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -610,7 +609,6 @@ impl<
> MonitorUpdatingPersister<K, L, ES, SP, BI, FE>
where
K::Target: KVStoreSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
/// Constructs a new [`MonitorUpdatingPersister`].
@@ -698,7 +696,7 @@ where
impl<
ChannelSigner: EcdsaChannelSigner,
K: Deref,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -706,7 +704,6 @@ impl<
> Persist<ChannelSigner> for MonitorUpdatingPersister<K, L, ES, SP, BI, FE>
where
K::Target: KVStoreSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
/// Persists a new channel. This means writing the entire monitor to the
@@ -781,7 +778,7 @@ where
pub struct MonitorUpdatingPersisterAsync<
K: Deref,
S: FutureSpawner,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -789,20 +786,18 @@ pub struct MonitorUpdatingPersisterAsync<
>(Arc<MonitorUpdatingPersisterAsyncInner<K, S, L, ES, SP, BI, FE>>)
where
K::Target: KVStore,
- L::Target: Logger,
SP::Target: SignerProvider + Sized;
struct MonitorUpdatingPersisterAsyncInner<
K: Deref,
S: FutureSpawner,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
FE: FeeEstimator,
> where
K::Target: KVStore,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
kv_store: K,
@@ -819,7 +814,7 @@ struct MonitorUpdatingPersisterAsyncInner<
impl<
K: Deref,
S: FutureSpawner,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -827,7 +822,6 @@ impl<
> MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where
K::Target: KVStore,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
/// Constructs a new [`MonitorUpdatingPersisterAsync`].
@@ -967,7 +961,7 @@ where
impl<
K: Deref + MaybeSend + MaybeSync + 'static,
S: FutureSpawner,
- L: Deref + MaybeSend + MaybeSync + 'static,
+ L: Logger + MaybeSend + MaybeSync + 'static,
ES: EntropySource + MaybeSend + MaybeSync + 'static,
SP: Deref + MaybeSend + MaybeSync + 'static,
BI: BroadcasterInterface + MaybeSend + MaybeSync + 'static,
@@ -975,7 +969,6 @@ impl<
> MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where
K::Target: KVStore + MaybeSync,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
<SP::Target as SignerProvider>::EcdsaSigner: MaybeSend + 'static,
{
@@ -1056,7 +1049,7 @@ impl<F: Future<Output = Result<(), io::Error>> + MaybeSend> MaybeSendableFuture
impl<
K: Deref,
S: FutureSpawner,
- L: Deref,
+ L: Logger,
ES: EntropySource,
SP: Deref,
BI: BroadcasterInterface,
@@ -1064,7 +1057,6 @@ impl<
> MonitorUpdatingPersisterAsyncInner<K, S, L, ES, SP, BI, FE>
where
K::Target: KVStore,
- L::Target: Logger,
SP::Target: SignerProvider + Sized,
{
pub async fn read_channel_monitor_with_updates(
diff --git a/lightning/src/util/sweep.rs b/lightning/src/util/sweep.rs
index a408833..f7cf277 100644
--- a/lightning/src/util/sweep.rs
+++ b/lightning/src/util/sweep.rs
@@ -343,13 +343,12 @@ pub struct OutputSweeper<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> where
D::Target: ChangeDestinationSource,
F::Target: Filter,
K::Target: KVStore,
- L::Target: Logger,
O::Target: OutputSpender,
{
sweeper_state: Mutex<SweeperState>,
@@ -369,14 +368,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> OutputSweeper<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSource,
F::Target: Filter,
K::Target: KVStore,
- L::Target: Logger,
O::Target: OutputSpender,
{
/// Constructs a new [`OutputSweeper`].
@@ -726,14 +724,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> Listen for OutputSweeper<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSource,
F::Target: Filter + Sync + Send,
K::Target: KVStore,
- L::Target: Logger,
O::Target: OutputSpender,
{
fn filtered_block_connected(
@@ -772,14 +769,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> Confirm for OutputSweeper<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSource,
F::Target: Filter + Sync + Send,
K::Target: KVStore,
- L::Target: Logger,
O::Target: OutputSpender,
{
fn transactions_confirmed(
@@ -874,14 +870,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> ReadableArgs<(B, E, Option<F>, O, D, K, L)> for (BestBlock, OutputSweeper<B, D, E, F, K, L, O>)
where
D::Target: ChangeDestinationSource,
F::Target: Filter + Sync + Send,
K::Target: KVStore,
- L::Target: Logger,
O::Target: OutputSpender,
{
#[inline]
@@ -949,13 +944,12 @@ pub struct OutputSweeperSync<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> where
D::Target: ChangeDestinationSourceSync,
F::Target: Filter,
K::Target: KVStoreSync,
- L::Target: Logger,
O::Target: OutputSpender,
{
sweeper:
@@ -968,14 +962,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> OutputSweeperSync<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSourceSync,
F::Target: Filter,
K::Target: KVStoreSync,
- L::Target: Logger,
O::Target: OutputSpender,
{
/// Constructs a new [`OutputSweeperSync`] instance.
@@ -1093,14 +1086,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> Listen for OutputSweeperSync<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSourceSync,
F::Target: Filter + Sync + Send,
K::Target: KVStoreSync,
- L::Target: Logger,
O::Target: OutputSpender,
{
fn filtered_block_connected(
@@ -1120,14 +1112,13 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> Confirm for OutputSweeperSync<B, D, E, F, K, L, O>
where
D::Target: ChangeDestinationSourceSync,
F::Target: Filter + Sync + Send,
K::Target: KVStoreSync,
- L::Target: Logger,
O::Target: OutputSpender,
{
fn transactions_confirmed(
@@ -1155,7 +1146,7 @@ impl<
E: FeeEstimator,
F: Deref,
K: Deref,
- L: Deref,
+ L: Logger,
O: Deref,
> ReadableArgs<(B, E, Option<F>, O, D, K, L)>
for (BestBlock, OutputSweeperSync<B, D, E, F, K, L, O>)
@@ -1163,7 +1154,6 @@ where
D::Target: ChangeDestinationSourceSync,
F::Target: Filter + Sync + Send,
K::Target: KVStoreSync,
- L::Target: Logger,
O::Target: OutputSpender,
{
#[inline]
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.