Skip to content

Commit 3ce1a5e

Browse files
committed
Move the ShutdownResult type alias to channel.rs
This allows us to make the `force_shutdown` definition less verbose
1 parent 660daaa commit 3ce1a5e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lightning/src/ln/channel.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ pub(super) struct ReestablishResponses {
432432
pub shutdown_msg: Option<msgs::Shutdown>,
433433
}
434434

435+
/// The return type of `force_shutdown`
436+
pub(crate) type ShutdownResult = (
437+
Option<(OutPoint, ChannelMonitorUpdate)>,
438+
Vec<(HTLCSource, PaymentHash, PublicKey, [u8; 32])>
439+
);
440+
435441
/// If the majority of the channels funds are to the fundee and the initiator holds only just
436442
/// enough funds to cover their reserve value, channels are at risk of getting "stuck". Because the
437443
/// initiator controls the feerate, if they then go to increase the channel fee, they may have no
@@ -6228,7 +6234,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
62286234
/// those explicitly stated to be allowed after shutdown completes, eg some simple getters).
62296235
/// Also returns the list of payment_hashes for channels which we can safely fail backwards
62306236
/// immediately (others we will have to allow to time out).
6231-
pub fn force_shutdown(&mut self, should_broadcast: bool) -> (Option<(OutPoint, ChannelMonitorUpdate)>, Vec<(HTLCSource, PaymentHash, PublicKey, [u8; 32])>) {
6237+
pub fn force_shutdown(&mut self, should_broadcast: bool) -> ShutdownResult {
62326238
// Note that we MUST only generate a monitor update that indicates force-closure - we're
62336239
// called during initialization prior to the chain_monitor in the encompassing ChannelManager
62346240
// being fully configured in some cases. Thus, its likely any monitor events we generate will

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa
4040
// Since this struct is returned in `list_channels` methods, expose it here in case users want to
4141
// construct one themselves.
4242
use crate::ln::{inbound_payment, PaymentHash, PaymentPreimage, PaymentSecret};
43-
use crate::ln::channel::{Channel, ChannelError, ChannelUpdateStatus, UpdateFulfillCommitFetch};
43+
use crate::ln::channel::{Channel, ChannelError, ChannelUpdateStatus, ShutdownResult, UpdateFulfillCommitFetch};
4444
use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
4545
#[cfg(any(feature = "_test_utils", test))]
4646
use crate::ln::features::InvoiceFeatures;
@@ -359,8 +359,6 @@ pub enum FailureCode {
359359
IncorrectOrUnknownPaymentDetails = 0x4000 | 15,
360360
}
361361

362-
type ShutdownResult = (Option<(OutPoint, ChannelMonitorUpdate)>, Vec<(HTLCSource, PaymentHash, PublicKey, [u8; 32])>);
363-
364362
/// Error type returned across the peer_state mutex boundary. When an Err is generated for a
365363
/// Channel, we generally end up with a ChannelError::Close for which we have to close the channel
366364
/// immediately (ie with no further calls on it made). Thus, this step happens inside a

0 commit comments

Comments
 (0)