Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add force_close_spend_delay filed for ChannelClosure #84

Merged
merged 5 commits into from
Feb 6, 2025

Conversation

EthanYuan
Copy link
Collaborator

@EthanYuan EthanYuan commented Jan 22, 2025

  • Add force_close_spend_delay filed for ChannelClosure, a call to the list_channel_closures method will reflect this
  • Add force_close_spend_delay filed for MutinyChannel, a call to the list_channels method will reflect this

force_close_spend_delay is set to None for older versions of the data.

/// Information about a channel that was closed.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Hash)]
#[wasm_bindgen]
pub struct ChannelClosure {
    channel_id: Option<String>,
    node_id: Option<String>,
    reason: String,
    pub timestamp: u64,
    channel_funding_txo: Option<String>,
    force_close_spend_delay: Option<u16>,
}
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq)]
#[wasm_bindgen]
pub struct MutinyChannel {
    user_chan_id: String,
    pub balance: u64,
    pub size: u64,
    pub reserve: u64,
    pub inbound: u64,
    outpoint: Option<String>,
    peer: String,
    pub confirmations_required: Option<u32>,
    pub confirmations: u32,
    pub is_outbound: bool,
    pub is_usable: bool,
    pub is_anchor: bool,
    pub force_close_spend_delay: Option<u16>,
}

The definition of force_close_spend_delay is as follows:

	/// The number of blocks (after our commitment transaction confirms) that we will need to wait
	/// until we can claim our funds after we force-close the channel. During this time our
	/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
	/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
	/// time to claim our non-HTLC-encumbered funds.
	///
	/// This value will be `None` for outbound channels until the counterparty accepts the channel.
	pub force_close_spend_delay: Option<u16>,

@EthanYuan EthanYuan marked this pull request as ready for review January 23, 2025 03:05
@EthanYuan EthanYuan force-pushed the persist_force_close_spend_delay branch from 8cc0568 to eff8e88 Compare January 23, 2025 03:07
@@ -970,6 +970,7 @@ impl MutinyWallet {
.list_channel_closures()
.await?
.into_iter()
.filter(|closure| closure.timestamp != 0) // filter out placeholder closures
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When channel_closeure stored as a placeholder, it can be filtered out when list_channel_closures is called from the front end. @Flouse @ShookLyngs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i see

@Flouse Flouse merged commit 7a2b841 into utxostack:develop Feb 6, 2025
9 checks passed
@EthanYuan EthanYuan deleted the persist_force_close_spend_delay branch February 7, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants