From e2cf3fffc95583bdc1e7964ca2c66108a4543d60 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 17 Jun 2024 14:47:51 -0500 Subject: [PATCH] Set min anchor channel fee to 1 sat/vbyte --- mutiny-core/src/fees.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mutiny-core/src/fees.rs b/mutiny-core/src/fees.rs index 666d8a225..43f7a1de8 100644 --- a/mutiny-core/src/fees.rs +++ b/mutiny-core/src/fees.rs @@ -190,6 +190,7 @@ impl FeeEstimator for MutinyFeeEstimator { // 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, } @@ -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, @@ -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"))]