Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 149318a

Browse files
authored
Merge pull request #1223 from MutinyWallet/min-anchor-fee
Set min anchor channel fee to 1 sat/vbyte
2 parents b4cf1bf + e2cf3ff commit 149318a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

mutiny-core/src/fees.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl<S: MutinyStorage> FeeEstimator for MutinyFeeEstimator<S> {
190190
// any post processing we do after we get the fee rate from the cache
191191
match confirmation_target {
192192
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => fee - 250, // helps with rounding errors
193+
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 250, // just pin to 1 sat/vbyte to prevent force closes
193194
ConfirmationTarget::AnchorChannelFee => (fee / 2).max(250), // do half the mempool minimum just to prevent force closes
194195
_ => fee,
195196
}
@@ -209,7 +210,7 @@ fn num_blocks_from_conf_target(confirmation_target: ConfirmationTarget) -> usize
209210

210211
fn fallback_fee_from_conf_target(confirmation_target: ConfirmationTarget) -> u32 {
211212
match confirmation_target {
212-
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 3 * 250,
213+
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 250,
213214
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => 3 * 250,
214215
ConfirmationTarget::ChannelCloseMinimum => 10 * 250,
215216
ConfirmationTarget::AnchorChannelFee => 10 * 250,
@@ -321,6 +322,16 @@ mod test {
321322
fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::OnChainSweep),
322323
12_500
323324
);
325+
326+
// test post-processing
327+
assert_eq!(
328+
fee_estimator
329+
.get_est_sat_per_1000_weight(ConfirmationTarget::MinAllowedAnchorChannelRemoteFee),
330+
250
331+
);
332+
assert!(
333+
fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::AnchorChannelFee) >= 250
334+
);
324335
}
325336

326337
#[cfg(not(target_arch = "wasm32"))]

0 commit comments

Comments
 (0)