mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Accept BumpTransactionEvent in handle_event
There's no reason to accept the general `Event` enum.
This commit is contained in:
parent
31a0456c0e
commit
a100ed0098
1 changed files with 9 additions and 9 deletions
|
@ -7,14 +7,15 @@
|
||||||
// You may not use this file except in accordance with one or both of these
|
// You may not use this file except in accordance with one or both of these
|
||||||
// licenses.
|
// licenses.
|
||||||
|
|
||||||
//! Utitilies for bumping transactions originating from [`super::Event`]s.
|
//! Utilities for bumping transactions originating from [`Event`]s.
|
||||||
|
//!
|
||||||
|
//! [`Event`]: crate::events::Event
|
||||||
|
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
|
|
||||||
use crate::chain::chaininterface::BroadcasterInterface;
|
use crate::chain::chaininterface::BroadcasterInterface;
|
||||||
use crate::chain::ClaimId;
|
use crate::chain::ClaimId;
|
||||||
use crate::events::Event;
|
|
||||||
use crate::io_extras::sink;
|
use crate::io_extras::sink;
|
||||||
use crate::ln::chan_utils;
|
use crate::ln::chan_utils;
|
||||||
use crate::ln::chan_utils::{
|
use crate::ln::chan_utils::{
|
||||||
|
@ -553,6 +554,8 @@ impl<W: Deref> CoinSelectionSource for Wallet<W> where W::Target: WalletSource {
|
||||||
/// A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a
|
/// A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a
|
||||||
/// [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or
|
/// [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or
|
||||||
/// Replace-By-Fee (RBF).
|
/// Replace-By-Fee (RBF).
|
||||||
|
///
|
||||||
|
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
|
||||||
pub struct BumpTransactionEventHandler<B: Deref, C: Deref, SP: Deref, L: Deref>
|
pub struct BumpTransactionEventHandler<B: Deref, C: Deref, SP: Deref, L: Deref>
|
||||||
where
|
where
|
||||||
B::Target: BroadcasterInterface,
|
B::Target: BroadcasterInterface,
|
||||||
|
@ -575,6 +578,8 @@ where
|
||||||
L::Target: Logger,
|
L::Target: Logger,
|
||||||
{
|
{
|
||||||
/// Returns a new instance capable of handling [`Event::BumpTransaction`] events.
|
/// Returns a new instance capable of handling [`Event::BumpTransaction`] events.
|
||||||
|
///
|
||||||
|
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
|
||||||
pub fn new(broadcaster: B, utxo_source: C, signer_provider: SP, logger: L) -> Self {
|
pub fn new(broadcaster: B, utxo_source: C, signer_provider: SP, logger: L) -> Self {
|
||||||
Self {
|
Self {
|
||||||
broadcaster,
|
broadcaster,
|
||||||
|
@ -749,13 +754,8 @@ where
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles all variants of [`BumpTransactionEvent`], immediately returning otherwise.
|
/// Handles all variants of [`BumpTransactionEvent`].
|
||||||
pub fn handle_event(&self, event: &Event) {
|
pub fn handle_event(&self, event: &BumpTransactionEvent) {
|
||||||
let event = if let Event::BumpTransaction(event) = event {
|
|
||||||
event
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
match event {
|
match event {
|
||||||
BumpTransactionEvent::ChannelClose {
|
BumpTransactionEvent::ChannelClose {
|
||||||
claim_id, package_target_feerate_sat_per_1000_weight, commitment_tx,
|
claim_id, package_target_feerate_sat_per_1000_weight, commitment_tx,
|
||||||
|
|
Loading…
Add table
Reference in a new issue