-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[feature]: sweep: implement alternative fee functions #8763
Comments
Hello Matt, I'd be interested in feedback from those reading along on the alternative. If there are no objections, I would like to start a first implementation draft in the coming weeks. Btw: Regardless of the methodology, there still seems to be an issue with calling the fee function. Otherwise it is not possible to explain why this pleb ended up at 1000 sat/vb although he was permanently online and onchain fees were low. https://mempool.space/tx/2a5b92a5be69799f9eb919e54426248c6fcb9c85e44692711761e34b1b1b2068 Downsides of the LinearFeeFunctionThe
Alternatives
|
0.9 | 0.95 | 0.975 | 0.99 | |
---|---|---|---|---|
1 | 2 | 2 | 2 | 2 |
6 | 1.59 | 1.77 | 1.88 | 1.95 |
40 | 1.02 | 1.14 | 1.37 | 1.68 |
144 | 1 | 1 | 1.03 | 1.24 |
With
Overall, the likelihood of not getting a confirmation with the model is very unlikely. This is actually only possible if the fees increase faster from block to block than the risk buffer at the time.
Edit:
- durign implementation we have to think about the case
$\lambda=0$ , because it leads to a$0^0$ situation
This is incorrect. A fee func is always initialized with an ending feerate derived from the budget. Only when the budget feerate exceeds the As for the budget, you can already configure it as detailed in this section. The whole point of the budget-based design is to move away from fee estimators, instead, we want to limit how much fees we want to pay in sats, as it's more accurate than using fee rate to restrict the onchain cost. I do think the fee func can be expanded, this is why there's this report as a starting point. If we want to implement more algorithms, I think we need to update the report, run the simulations, and update our knowledge about the effects of the different algorithms. |
Sorry, it was not my intention to portray anything as incorrect. With the usual htlc sizes and with the default settings of the budgets, however, it will usually always run out to 1000 sat/vb as initial param. An HTLC of 300k is completely sufficient. I also think a budget-based approach is very good. However, I would only see a budget as a final cap on the output and not as a target value for the algorithm. The cap should be preceded by a function that returns a very risk-averse value based on the current on-chain fee estimates. I have described a possible model approach above. |
Suppose we are sweeping an incoming HTLC in a tx, the estimated weight is 1142 wu, given the max fee rate of 1000 sat/vb, which is 250 sat/wu, and a default budget conf of 50%, the HTLC must be greater than 571k sats to reach the max fee rate, since the ending fee rate is calculated using For outgoing it's a similar value, around 533k. But due to a temp issue this is 4x smaller until #7683 is fixed. On the other hand, if the HTLC has a large value, it's recommended to cap the budget using
Aside from being budget-based, the sweeper is also deadline-based, which means it has already considered the timeout risk. For every block the tx is unconfirmed, there's always a tradeoff - spend more to wait for fewer blocks, or spend less but wait a few more blocks. And the idea here is, the user specifies the max fees he/she is willing to pay to get it confirmed before the deadline hits. As for the model, the important question is, given the current reliability of fee estimators, how do you know "the current on-chain fees"? If the fee estimators can accurately tell us the network feerate, we don't even need the fee function. |
I had this example in my mind. Maybe the issue was the reason that 315k were enough
By “current on-chain fees” I meant the current return values of the estimator for the number of blocks until deadline. However, this can only be a lower limit on which a multiplier must be applied as a risk buffer in order to be really safe. To determine the multiplier, the noderunner can surgically analyze the historical on-chain data or simply make a conservative expert estimate. |
The current
LinearFeeFunction
is reasonable for short deadlines (e.g., < 10 blocks) where it is critical to confirm things quickly, but it may be overly aggressive for longer deadlines (e.g., 80+ blocks).By implementing other fee curves we can optimize for different deadlines and save fees. See @yyforyongyu's thorough evaluation of several curves.
The text was updated successfully, but these errors were encountered: