Skip to content

Commit a100ed0

Browse files
committed
Accept BumpTransactionEvent in handle_event
There's no reason to accept the general `Event` enum.
1 parent 31a0456 commit a100ed0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lightning/src/events/bump_transaction.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
//! Utitilies for bumping transactions originating from [`super::Event`]s.
10+
//! Utilities for bumping transactions originating from [`Event`]s.
11+
//!
12+
//! [`Event`]: crate::events::Event
1113
1214
use core::convert::TryInto;
1315
use core::ops::Deref;
1416

1517
use crate::chain::chaininterface::BroadcasterInterface;
1618
use crate::chain::ClaimId;
17-
use crate::events::Event;
1819
use crate::io_extras::sink;
1920
use crate::ln::chan_utils;
2021
use crate::ln::chan_utils::{
@@ -553,6 +554,8 @@ impl<W: Deref> CoinSelectionSource for Wallet<W> where W::Target: WalletSource {
553554
/// A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a
554555
/// [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or
555556
/// Replace-By-Fee (RBF).
557+
///
558+
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
556559
pub struct BumpTransactionEventHandler<B: Deref, C: Deref, SP: Deref, L: Deref>
557560
where
558561
B::Target: BroadcasterInterface,
@@ -575,6 +578,8 @@ where
575578
L::Target: Logger,
576579
{
577580
/// Returns a new instance capable of handling [`Event::BumpTransaction`] events.
581+
///
582+
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
578583
pub fn new(broadcaster: B, utxo_source: C, signer_provider: SP, logger: L) -> Self {
579584
Self {
580585
broadcaster,
@@ -749,13 +754,8 @@ where
749754
Ok(())
750755
}
751756

752-
/// Handles all variants of [`BumpTransactionEvent`], immediately returning otherwise.
753-
pub fn handle_event(&self, event: &Event) {
754-
let event = if let Event::BumpTransaction(event) = event {
755-
event
756-
} else {
757-
return;
758-
};
757+
/// Handles all variants of [`BumpTransactionEvent`].
758+
pub fn handle_event(&self, event: &BumpTransactionEvent) {
759759
match event {
760760
BumpTransactionEvent::ChannelClose {
761761
claim_id, package_target_feerate_sat_per_1000_weight, commitment_tx,

0 commit comments

Comments
 (0)