Bitcoin backend: batch fee estimation requests#3570
Conversation
506703c to
79ace3e
Compare
niftynei
left a comment
There was a problem hiding this comment.
something to think about: this PR locks us into the 3 definitions of "urgent, normal, slow" in a harder to change way than the previous method of calling getfeerate 3 times. i can see how this is preferable for a plugin API.
further it canonicalizes 'urgent, normal and slow', while removing the bitcoind standard that we adhered to previously of CONSERVATIVE/2 , ECONOMICAL/100 etc. what guarantees do these new standards require? i.e. if a plugin reports back an urgent feerate, how fast does that mean it'll be mined on average? bitcoind lays these out for their feerate API, and by moving away from them we're opening up some possibility for interpretation. we should add some strong guidelines around the meaning of them in any bitcoin-plugin documentation, and perhaps annotate them in this commit series as well.
d02b8bb to
256cffb
Compare
imho it's an improvement, this classification is clearer, not backend-specific, and closer to what we use internally.
That's not a complete removal,
We completely trust the plugin for providing an urgent feerate when asked, and it doesn't change default behaviour at all as we still use CONSERVATIVE/2 for urgent feerate in
Yep, the doc is ready and yet to come once we have the final API. |
|
Agree with @niftynei that these differentiations suck. We should expose them by usage. Currently we use the following:
Perhaps we should expose these directly via the API? Frankly, returning HTLC to wallet (if timed out) should probably be more urgent, whereas the other onchaind cases should be slower. An even better API would allow an amount and a timeout (in number of blocks), where the amount says how much we'd lose, and the timeout says how many blocks we have. |
|
Ok. I've looked into it and propose the following feerates :
I propose to also bump the |
256cffb to
9e4102e
Compare
|
Ok so now the patchset is bigger and breaks some APIs but it's really better this way, I think :). So, this now changes our feerate tracking from
I'll propose this as an other PR, what do you think of CONSERVATIVE/3 ? |
vasild
left a comment
There was a problem hiding this comment.
Code review about OK. Notice that I am missing some pieces of the big picture.
Some comments follow, feel free to ignore them (except the one about feerate[3]).
9e4102e to
6cda3d5
Compare
|
Thanks for the review @vasild ! Sorry for the obvious fails I was too eager so push that I didn't review the cherry-picked commits of the old version :/ |
6cda3d5 to
a48ef0e
Compare
|
Added two commits for handling the max_fee multiplier |
c7c25c4 to
6dcf600
Compare
|
#3542 is related to this; see comment regarding desired API for specifying a default feerate policy for |
6dcf600 to
fe98530
Compare
fe98530 to
b712a6f
Compare
|
Corrected the wrong comments (BTC/kVB => sat/kVB) |
rustyrussell
left a comment
There was a problem hiding this comment.
Minor comments only.
Ack b712a6f
b712a6f to
dcaf75f
Compare
|
Corrected, and rebased. |
|
ACK dcaf75f, light code review |
This allows us to set more fine-grained feerate for onchain resolution. We still give it the same feerate for all types, but this will change as we move feerates to bcli.
We kept track of an URGENT, a NORMAL, and a SLOW feerate. They were used for opening (NORMAL), mutual (NORMAL), UNILATERAL (URGENT) transactions as well as minimum and maximum estimations, and onchain resolution. We now keep track of more fine-grained feerates: - `opening` used for funding and also misc transactions - `mutual_close` used for the mutual close transaction - `unilateral_close` used for unilateral close (commitment transactions) - `delayed_to_us` used for resolving our output from our unilateral close - `htlc_resolution` used for resolving onchain HTLCs - `penalty` used for resolving revoked transactions We don't modify our requests to our Bitcoin backend, as the next commit will batch them ! Changelog-deprecated: The "urgent", "slow", and "normal" field of the `feerates` command are now deprecated. Changelog-added: The fields "opening", "mutual_close", "unilateral_close", "delayed_to_us", "htlc_resolution" and "penalty" have been added to the `feerates` command.
This adapts our fee estimations requests to the Bitcoin backend to the new semantic, and batch the requests. This makes our request for fees much simpler, and leaves some more flexibility for a plugin to do something smart (it could still lie before but now it's explicit, at least.) as we don't explicitly request estimation for a specific mode and a target. Changelog-Changed: We now batch the requests for fee estimation to our Bitcoin backend. Changelog-Changed: We now get more fine-grained fee estimation from our Bitcoin backend.
We keep the same behaviour as lightningd before.
Changelog-Changed: "htlc_timeout_satoshis" and "htlc_success_satoshis" fields have been added to the `feerates` command.
That way we pass the real min_acceptable (SLOW/2) and max_acceptable (URGENT * 10) feerates to lightningd.
dcaf75f to
eff7241
Compare
|
Re-rebased after #3572 was merged. |
|
Ack eff7241 |
EDIT: the scope changed from just batching feerate requests, cf #3570 (comment)
fixes #3508