// always return a HighPriority feerate here which is >= the maximum Normal feerate and a
// Background feerate which is <= the minimum Normal feerate.
match conf_target {
- ConfirmationTarget::OnChainSweep => MAX_FEE,
+ ConfirmationTarget::MaximumFeeEstimate | ConfirmationTarget::OnChainSweep => MAX_FEE,
ConfirmationTarget::ChannelCloseMinimum
| ConfirmationTarget::AnchorChannelFee
| ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
/// estimation.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub enum ConfirmationTarget {
+ /// The most aggressive (i.e. highest) feerate estimate available.
+ ///
+ /// This is used to sanity-check our counterparty's feerates and should be as conservative as
+ /// possible to ensure that we don't confuse a peer using a very conservative estimator for one
+ /// trying to burn channel balance to dust.
+ MaximumFeeEstimate,
/// We have some funds available on chain which we need to spend prior to some expiry time at
/// which point our counterparty may be able to steal them. Generally we have in the high tens
/// to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a
fn get_dust_exposure_limiting_feerate<F: Deref>(&self,
fee_estimator: &LowerBoundedFeeEstimator<F>,
) -> u32 where F::Target: FeeEstimator {
- fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::OnChainSweep)
+ fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::MaximumFeeEstimate)
}
pub fn get_max_dust_htlc_exposure_msat(&self, limiting_feerate_sat_per_kw: u32) -> u64 {
/// to this maximum the channel may be unable to send/receive HTLCs between the maximum dust
/// exposure and the new minimum value for HTLCs to be economically viable to claim.
FixedLimitMsat(u64),
- /// This sets a multiplier on the [`ConfirmationTarget::OnChainSweep`] feerate (in sats/KW) to
- /// determine the maximum allowed dust exposure. If this variant is used then the maximum dust
- /// exposure in millisatoshis is calculated as:
+ /// This sets a multiplier on the [`ConfirmationTarget::MaximumFeeEstimate`] feerate (in
+ /// sats/KW) to determine the maximum allowed dust exposure. If this variant is used then the
+ /// maximum dust exposure in millisatoshis is calculated as:
/// `feerate_per_kw * value`. For example, with our default value
/// `FeeRateMultiplier(10_000)`:
///
/// by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat.
///
/// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
- /// [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
+ /// [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate
FeeRateMultiplier(u64),
}
/// Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement
/// will scale linearly with increases (or decreases) in the our feerate estimates. Further,
/// for anchor channels we expect our counterparty to use a relatively low feerate estimate
- /// while we use [`ConfirmationTarget::OnChainSweep`] (which should be relatively high) and
- /// feerate disagreement force-closures should only occur when theirs is higher than ours.
+ /// while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high)
+ /// and feerate disagreement force-closures should only occur when theirs is higher than ours.
///
/// Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000`
///
- /// [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
+ /// [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate
pub max_dust_htlc_exposure: MaxDustHTLCExposure,
/// The additional fee we're willing to pay to avoid waiting for the counterparty's
/// `to_self_delay` to reclaim funds.