Skip to content

Commit 6072707

Browse files
committed
Use ChannelSigner instead of ChanSigner for type parameters
1 parent 6fd02fa commit 6072707

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

lightning-persister/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ impl FilesystemPersister {
130130
}
131131
}
132132

133-
impl<ChanSigner: Sign + Send + Sync> channelmonitor::Persist<ChanSigner> for FilesystemPersister {
134-
fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr> {
133+
impl<ChannelSigner: Sign + Send + Sync> channelmonitor::Persist<ChannelSigner> for FilesystemPersister {
134+
fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr> {
135135
self.write_channel_data(funding_txo, monitor)
136136
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
137137
}
138138

139-
fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &ChannelMonitorUpdate, monitor: &ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr> {
139+
fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &ChannelMonitorUpdate, monitor: &ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr> {
140140
self.write_channel_data(funding_txo, monitor)
141141
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
142142
}

lightning/src/chain/chainmonitor.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,28 @@ use std::ops::Deref;
5656
/// [`chain::Watch`]: ../trait.Watch.html
5757
/// [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
5858
/// [module-level documentation]: index.html
59-
pub struct ChainMonitor<ChanSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref>
59+
pub struct ChainMonitor<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref>
6060
where C::Target: chain::Filter,
6161
T::Target: BroadcasterInterface,
6262
F::Target: FeeEstimator,
6363
L::Target: Logger,
64-
P::Target: channelmonitor::Persist<ChanSigner>,
64+
P::Target: channelmonitor::Persist<ChannelSigner>,
6565
{
6666
/// The monitors
67-
pub monitors: Mutex<HashMap<OutPoint, ChannelMonitor<ChanSigner>>>,
67+
pub monitors: Mutex<HashMap<OutPoint, ChannelMonitor<ChannelSigner>>>,
6868
chain_source: Option<C>,
6969
broadcaster: T,
7070
logger: L,
7171
fee_estimator: F,
7272
persister: P,
7373
}
7474

75-
impl<ChanSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> ChainMonitor<ChanSigner, C, T, F, L, P>
75+
impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> ChainMonitor<ChannelSigner, C, T, F, L, P>
7676
where C::Target: chain::Filter,
7777
T::Target: BroadcasterInterface,
7878
F::Target: FeeEstimator,
7979
L::Target: Logger,
80-
P::Target: channelmonitor::Persist<ChanSigner>,
80+
P::Target: channelmonitor::Persist<ChannelSigner>,
8181
{
8282
/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
8383
/// of a channel and reacting accordingly based on transactions in the connected block. See
@@ -140,13 +140,13 @@ where C::Target: chain::Filter,
140140
}
141141
}
142142

143-
impl<ChanSigner: Sign, C: Deref + Sync + Send, T: Deref + Sync + Send, F: Deref + Sync + Send, L: Deref + Sync + Send, P: Deref + Sync + Send>
144-
chain::Watch<ChanSigner> for ChainMonitor<ChanSigner, C, T, F, L, P>
143+
impl<ChannelSigner: Sign, C: Deref + Sync + Send, T: Deref + Sync + Send, F: Deref + Sync + Send, L: Deref + Sync + Send, P: Deref + Sync + Send>
144+
chain::Watch<ChannelSigner> for ChainMonitor<ChannelSigner, C, T, F, L, P>
145145
where C::Target: chain::Filter,
146146
T::Target: BroadcasterInterface,
147147
F::Target: FeeEstimator,
148148
L::Target: Logger,
149-
P::Target: channelmonitor::Persist<ChanSigner>,
149+
P::Target: channelmonitor::Persist<ChannelSigner>,
150150
{
151151
/// Adds the monitor that watches the channel referred to by the given outpoint.
152152
///
@@ -156,7 +156,7 @@ where C::Target: chain::Filter,
156156
/// monitors lock.
157157
///
158158
/// [`chain::Filter`]: ../trait.Filter.html
159-
fn watch_channel(&self, funding_outpoint: OutPoint, monitor: ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr> {
159+
fn watch_channel(&self, funding_outpoint: OutPoint, monitor: ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr> {
160160
let mut monitors = self.monitors.lock().unwrap();
161161
let entry = match monitors.entry(funding_outpoint) {
162162
hash_map::Entry::Occupied(_) => {
@@ -232,12 +232,12 @@ where C::Target: chain::Filter,
232232
}
233233
}
234234

235-
impl<ChanSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> events::EventsProvider for ChainMonitor<ChanSigner, C, T, F, L, P>
235+
impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> events::EventsProvider for ChainMonitor<ChannelSigner, C, T, F, L, P>
236236
where C::Target: chain::Filter,
237237
T::Target: BroadcasterInterface,
238238
F::Target: FeeEstimator,
239239
L::Target: Logger,
240-
P::Target: channelmonitor::Persist<ChanSigner>,
240+
P::Target: channelmonitor::Persist<ChannelSigner>,
241241
{
242242
fn get_and_clear_pending_events(&self) -> Vec<Event> {
243243
let mut pending_events = Vec::new();

lightning/src/chain/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub trait Access: Send + Sync {
6767
/// [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
6868
/// [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
6969
/// [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
70-
pub trait Watch<ChanSigner: Sign>: Send + Sync {
70+
pub trait Watch<ChannelSigner: Sign>: Send + Sync {
7171
/// Watches a channel identified by `funding_txo` using `monitor`.
7272
///
7373
/// Implementations are responsible for watching the chain for the funding transaction along
@@ -77,7 +77,7 @@ pub trait Watch<ChanSigner: Sign>: Send + Sync {
7777
/// [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
7878
/// [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
7979
/// [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
80-
fn watch_channel(&self, funding_txo: OutPoint, monitor: ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr>;
80+
fn watch_channel(&self, funding_txo: OutPoint, monitor: ChannelMonitor<ChannelSigner>) -> Result<(), ChannelMonitorUpdateErr>;
8181

8282
/// Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8383
///

lightning/src/ln/onchaintx.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl Writeable for Option<Vec<Option<(usize, Signature)>>> {
240240

241241
/// OnchainTxHandler receives claiming requests, aggregates them if it's sound, broadcast and
242242
/// do RBF bumping if possible.
243-
pub struct OnchainTxHandler<ChanSigner: Sign> {
243+
pub struct OnchainTxHandler<ChannelSigner: Sign> {
244244
destination_script: Script,
245245
holder_commitment: HolderCommitmentTransaction,
246246
// holder_htlc_sigs and prev_holder_htlc_sigs are in the order as they appear in the commitment
@@ -250,7 +250,7 @@ pub struct OnchainTxHandler<ChanSigner: Sign> {
250250
prev_holder_commitment: Option<HolderCommitmentTransaction>,
251251
prev_holder_htlc_sigs: Option<Vec<Option<(usize, Signature)>>>,
252252

253-
signer: ChanSigner,
253+
signer: ChannelSigner,
254254
pub(crate) channel_transaction_parameters: ChannelTransactionParameters,
255255

256256
// Used to track claiming requests. If claim tx doesn't confirm before height timer expiration we need to bump
@@ -287,7 +287,7 @@ pub struct OnchainTxHandler<ChanSigner: Sign> {
287287
secp_ctx: Secp256k1<secp256k1::All>,
288288
}
289289

290-
impl<ChanSigner: Sign> OnchainTxHandler<ChanSigner> {
290+
impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
291291
pub(crate) fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
292292
self.destination_script.write(writer)?;
293293
self.holder_commitment.write(writer)?;
@@ -423,8 +423,8 @@ impl<'a, K: KeysInterface> ReadableArgs<&'a K> for OnchainTxHandler<K::Signer> {
423423
}
424424
}
425425

426-
impl<ChanSigner: Sign> OnchainTxHandler<ChanSigner> {
427-
pub(crate) fn new(destination_script: Script, signer: ChanSigner, channel_parameters: ChannelTransactionParameters, holder_commitment: HolderCommitmentTransaction) -> Self {
426+
impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
427+
pub(crate) fn new(destination_script: Script, signer: ChannelSigner, channel_parameters: ChannelTransactionParameters, holder_commitment: HolderCommitmentTransaction) -> Self {
428428
OnchainTxHandler {
429429
destination_script,
430430
holder_commitment,

0 commit comments

Comments
 (0)