htlcswitch/[feature]: dynamically regulate the max anchor fee based on subjective min relay fee and peer's feefilter #8302
Labels
bitcoind
Bitcoin Core backend
enhancement
Improvements to existing features / behaviour
fees
Related to the fees paid for transactions (both LN and funding/commitment transactions)
mempool
P1
MUST be fixed or reviewed
Milestone
Is your feature request related to a problem? Please describe.
Today for anchor channels, we have a value
max-commit-fee-rate-anchors
that regulates the highest fee rate in sat/vbyte that we'll use for our commitment transaction. Under the hood, there's more logic here, but for the most part, users can set this value in order to ensure that their commitment transaction will properly propagate in the case of a force close.This worked ok in prior times of a calm mempool, but these days, rapid spikes in the mempool can easily render the default of 10 sat/byte much too low to effectively propagate.
One other relevant interaction is that of the
feefilter
message, specified in BIP 133. Peers send this message to tell other peers that they shouldn't send transactions below a certain fee rate. This fee rate is a function of their current mempool size, and also their configured max mempool size.Recently, I've seen an affect wherein the min mempool fee of my node is much lower than the fee rate advertised by many of my peers. As a result, even with the default of a 300 MB mempool, my node's mempool is well below that value as due to transitive propagation obstructions caused by the
feefilter
message, there's a class of transactions my node never actually sees.This is where a key propagation issue can arise:
lnd/htlcswitch/link.go
Line 1159 in 30348ba
lnd/lnwallet/chainfee/estimator.go
Line 364 in 30348ba
feefilter
value of a sample of peers:Compare that to my min mempool fee:
"mempoolminfee": 0.00001000
.Describe the solution you'd like
We should factor the
minfeefilter
value available ingetpeerinfo
into the algorithm we choose to set the current anchor commitment fee rate. In the case above, even with a default value of 10 sat/byte as the max, due to the current logic, we're able to get into our mempool, but not our peer's mempool, and therefore not their peer's peer's mempool and so on.We shouldn't just take these values as is though, to protect against a degree of manipulation we may want to use some smoothing like a moving average sampled periodically.
We should also factor this into the sweeper as well, since any time sensitive sweeps need to be above this value in order to actually propagate.
With this in place, we should be able to get rid of the
max-commit-fee-rate-anchors
and take the guess work out of running a secure node.The text was updated successfully, but these errors were encountered: