Skip to content

Commit 49fbb5b

Browse files
committed
Run rustfmt on chain/mod.rs/re-enable it on the chain module
In d257b8a we dropped our old `rustfmt` per-file exclusion logic and replaced it with `rustfmt_skip` tags in each previously-skipped files. This had the unintended consequence of fully disabling `rustfmt` across the `lightning` crate: `rustfmt` operates recursively across files in any module it is told to format. Previously, because we were running `rustfmt` on each non-excluded file, this meant we wanted to exclude `mod.rs` and `lib.rs` files - not doing so would result in the entire module/crate being formatted. However, `cargo fmt --check` only runs `rustfmt` once - on `lib.rs`. Because we added a top-level `rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and all modules. Here we prepare to fix this by formatting `lightning/src/chain/mod.rs`.
1 parent 8aae34e commit 49fbb5b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lightning/src/chain/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg_attr(rustfmt, rustfmt_skip)]
2-
31
// This file is Copyright its original authors, visible in version control
42
// history.
53
//
@@ -13,26 +11,26 @@
1311
1412
use bitcoin::block::{Block, Header};
1513
use bitcoin::constants::genesis_block;
16-
use bitcoin::script::{Script, ScriptBuf};
1714
use bitcoin::hash_types::{BlockHash, Txid};
1815
use bitcoin::network::Network;
16+
use bitcoin::script::{Script, ScriptBuf};
1917
use bitcoin::secp256k1::PublicKey;
2018

2119
use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, MonitorEvent};
22-
use crate::ln::types::ChannelId;
23-
use crate::sign::ecdsa::EcdsaChannelSigner;
2420
use crate::chain::transaction::{OutPoint, TransactionData};
2521
use crate::impl_writeable_tlv_based;
22+
use crate::ln::types::ChannelId;
23+
use crate::sign::ecdsa::EcdsaChannelSigner;
2624

2725
#[allow(unused_imports)]
2826
use crate::prelude::*;
2927

3028
pub mod chaininterface;
3129
pub mod chainmonitor;
3230
pub mod channelmonitor;
33-
pub mod transaction;
3431
pub(crate) mod onchaintx;
3532
pub(crate) mod package;
33+
pub mod transaction;
3634

3735
/// The best known block as identified by its hash and height.
3836
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
@@ -47,10 +45,7 @@ impl BestBlock {
4745
/// Constructs a `BestBlock` that represents the genesis block at height 0 of the given
4846
/// network.
4947
pub fn from_network(network: Network) -> Self {
50-
BestBlock {
51-
block_hash: genesis_block(network).header.block_hash(),
52-
height: 0,
53-
}
48+
BestBlock { block_hash: genesis_block(network).header.block_hash(), height: 0 }
5449
}
5550

5651
/// Returns a `BestBlock` as identified by the given block hash and height.
@@ -67,7 +62,6 @@ impl_writeable_tlv_based!(BestBlock, {
6762
(2, height, required),
6863
});
6964

70-
7165
/// The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7266
/// chain.
7367
///
@@ -289,7 +283,9 @@ pub trait Watch<ChannelSigner: EcdsaChannelSigner> {
289283
/// [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
290284
/// [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
291285
/// [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
292-
fn watch_channel(&self, channel_id: ChannelId, monitor: ChannelMonitor<ChannelSigner>) -> Result<ChannelMonitorUpdateStatus, ()>;
286+
fn watch_channel(
287+
&self, channel_id: ChannelId, monitor: ChannelMonitor<ChannelSigner>,
288+
) -> Result<ChannelMonitorUpdateStatus, ()>;
293289

294290
/// Updates a channel identified by `channel_id` by applying `update` to its monitor.
295291
///
@@ -306,7 +302,9 @@ pub trait Watch<ChannelSigner: EcdsaChannelSigner> {
306302
/// [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info.
307303
///
308304
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
309-
fn update_channel(&self, channel_id: ChannelId, update: &ChannelMonitorUpdate) -> ChannelMonitorUpdateStatus;
305+
fn update_channel(
306+
&self, channel_id: ChannelId, update: &ChannelMonitorUpdate,
307+
) -> ChannelMonitorUpdateStatus;
310308

311309
/// Returns any monitor events since the last call. Subsequent calls must only return new
312310
/// events.
@@ -317,7 +315,9 @@ pub trait Watch<ChannelSigner: EcdsaChannelSigner> {
317315
///
318316
/// For details on asynchronous [`ChannelMonitor`] updating and returning
319317
/// [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
320-
fn release_pending_monitor_events(&self) -> Vec<(OutPoint, ChannelId, Vec<MonitorEvent>, PublicKey)>;
318+
fn release_pending_monitor_events(
319+
&self,
320+
) -> Vec<(OutPoint, ChannelId, Vec<MonitorEvent>, PublicKey)>;
321321
}
322322

323323
/// The `Filter` trait defines behavior for indicating chain activity of interest pertaining to

0 commit comments

Comments
 (0)