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

Set min anchor channel fee to 1 sat/vbyte #1223

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion mutiny-core/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl<S: MutinyStorage> FeeEstimator for MutinyFeeEstimator<S> {
// any post processing we do after we get the fee rate from the cache
match confirmation_target {
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => fee - 250, // helps with rounding errors
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 250, // just pin to 1 sat/vbyte to prevent force closes
ConfirmationTarget::AnchorChannelFee => (fee / 2).max(250), // do half the mempool minimum just to prevent force closes
_ => fee,
}
Expand All @@ -209,7 +210,7 @@ fn num_blocks_from_conf_target(confirmation_target: ConfirmationTarget) -> usize

fn fallback_fee_from_conf_target(confirmation_target: ConfirmationTarget) -> u32 {
match confirmation_target {
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 3 * 250,
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 250,
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => 3 * 250,
ConfirmationTarget::ChannelCloseMinimum => 10 * 250,
ConfirmationTarget::AnchorChannelFee => 10 * 250,
Expand Down Expand Up @@ -321,6 +322,16 @@ mod test {
fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::OnChainSweep),
12_500
);

// test post-processing
assert_eq!(
fee_estimator
.get_est_sat_per_1000_weight(ConfirmationTarget::MinAllowedAnchorChannelRemoteFee),
250
);
assert!(
fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::AnchorChannelFee) >= 250
);
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down
Loading