-
Notifications
You must be signed in to change notification settings - Fork 42
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
Rework of fee estimation #102
Conversation
Im still running into the fee agreement issue while running this PR: |
maybe more useful logs
|
I was able to perform a swap out on btc chain using this PR, and didnt hit the |
This test error is a timeout that I suspect might be harmless? Not sure. In any case this is an improvement for LND which earlier today had broken fee estimation so it's worth testing for LND users. |
Nono, I kicked ci a few times with the same error. Give me some time to understand and fix it! It now failed in the other direction concerning cln and lnd. |
Maybe the timeouts are not new? Between CLN and LND with #102 yesterday I saw some timeouts. There's also a known bug with CLN v0.11.2 where payments can break entirely while the channel works for |
We want to have an estimator interface that allows for multiple backend implementations to provide the same fee estimation for the cln plugin as for the lnd daemon.
If this is tested on signet/mainnet I squash the commit to make it ready to be merged |
Squashed the fixups and removed the draft status. |
Visually inspecting the changes today may be confusing due to the subsequent rebase on top of master. https://github.com/ElementsProject/peerswap/compare/test-83-97-102..test-102-jul17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ grep -r 'CONSERVATIVE'
onchain/estimator.go: // must be one of "UNSET", "ECONOMICAL" or "CONSERVATIVE" and defaults to
onchain/estimator.go: // "CONSERVATIVE".
onchain/estimator_test.go: "CONSERVATIVE",
Should these be changed to ECONOMICAL as well?
04dee90 |
ACK 04dee90 Please add one more trivial commit to get rid of the last |
…nterface. We use gbitcoin as our RPC proxy for bitcoind connection and calls. This estimator mimics lnds bitcoind estimator such that we will get reliable and same results for Peerswap on lnd and Peerswap on cln.
The LndEstimator uses lnds walletkit RPC EstimateFee call to fetch the fee estimation from lnds internal estimator.
We now use the Estimator interface in BitcoinOnchain to estimate the fees. The GetFee command now also has a fallback and floor fee rate where the floor is set to 1.1 sat/vb.
This uses the current head of master that includes a PR that enables the use of the "getmempoolinfo" call.
We had no documentation on how the stubs were built. Now we can use the Makefile for stub generation.
The lnd fee estimator returns a static fee rate if lnd is used on the regtest network. In order to match this behavior for integration tests. We add the static RegtestFeeEstimator to the cln plugin that is used if bitcoind is configured to use regtest.
Changed commits: f1fafe3, 6075df5, to address the change from "CONSERVATIVE" to "ECONOMICAL" in tests and to remove the default part in the comment. |
This is a complete rework of the fee estimation. This pr introduces an Estimator interface to allow for lnds internal and bitcoind fee estimation. The following two estimator implementations are provided:
gbitcoin
api fromglightning
to access the bitcoind backend. The estimator mimics the behavior that lnd is using to provide a common way for fee estimation. We can set a fallback fee rate and have a constant floor fee rate of253 sat/kw
The
BitcoinOnchain
service uses the new estimators that return the fee rate insat/kw
. Also afallbackFeeRateSatPerKw
and afloorFeeRateSatPerKw
are provided while the former can be set on service creation, the later is a constant fixed to275 sat/kw
which equals1.1 sat/vb
.If the fee rate returned by the estimator is below the floor, the floor will be used for estimation. The fallback is used if the estimator does return an error or an 0 fee rate.
This PR includes PRs #100 and #79
Please do not merge this PR until ElementsProject/glightning#1 got merged as it depends on my fork nepet/glightning@gbitcoin/add-public-request right now