-
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
add sats_per_kweight option when crafting a transaction #7454
base: master
Are you sure you want to change the base?
Conversation
|
takes a bit longer because I want to add itests for all the functions to easily test that changes work. |
865ac47
to
24172ae
Compare
Still some open questions I have:
|
24172ae
to
fdf45ff
Compare
This PR needs some rework from my side because I did renumber protofile nummeration not thinking of backwards compatibility issues. So will rework in the next days. Learned this from guggero and his comment here: |
5cd122b
to
1830bc2
Compare
I updated this PR to make the RPC chane backwards-compatible. I included itests for commands which now have the new sat_per_kweight option. Only for From my POV this PR is ready for review. Don't be intimidated by the amount of lines which were changed. The change is minor but the walletrpc and lnrpc commands changed therefore the change appears to be big. |
db5a47c
to
eaf2f61
Compare
a190f7a
to
d3697e3
Compare
@joostjager: review reminder |
!lightninglabs-deploy mute |
adda622
to
4cd7db0
Compare
4cd7db0
to
db09d65
Compare
FYI: I'd love to see this merged. Currently, it has a bunch of merge conflicts. |
This commit has to include all these subsystems because the rpc value sat_per_byte is replaced with the sat_per_kweight option and otherwise the commit would not be compilable by itself. lnrpc: For OpenChannelRequest, BatchOpenChannelRequest, SendCoinsRequest SendManyRequest, CloseChannelRequest and EstimateFeeResponse the sat_per_kweight field is added or replaced for the deprecated sat_per_byte field where applicable. This allows for more fine granular control of transaction fees. lnd: Fee calculation for sendcoins, sendmany, openchannel, closechannel has now the option sat_per_kweight. The option sat_per_byte is replaced by sat_per_kweight. In addition a safety check is added to prevent very high fees. For the estimatefee cmd the fee in sat_per_kweight is added to the response. lncli,itest,lntest: remove usage of sat_per_byte option.
Add the sat_per_kweight for the rpc calls FundPsbt, BumpFee and Pendingsweeps. Where applicable the sat_per_byte option is replaced by the sat_per_kweight option.
Adopt the option sat_per_kweight for batch channel openings.
db09d65
to
7c42210
Compare
Important Auto Review SkippedAuto reviews are limited to the following labels: llm-review. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
7c42210
to
aea6fb0
Compare
Fixed the merge conflicts should be good now, will take a closer look in LND 19 but you could check by yourself if you want this feature now and merge it into your version. |
Add new itests for openchannel,sendcoins,sendmany, fund psbt and bumpfee rpc calls. In addition the RBF logic is now tested in the itests (bumpfee) resolving an outstanding TODO.
The deprecated option sat_per_byte is replaced by the new sat_per_kweight option where applicable otherwise it is added. Add the sat_per_kweight option for the lnrpc cmds sendcoins, sendmany, openchannel, batchopenchannel, closechannel. Also return the sat_per_kweight for estimatefee in the response. Add sat_per_kweight option for walletrpc cmds "wallet psbt fund" and "wallet bumpfee".
aea6fb0
to
0613a60
Compare
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.
PR has been untouched for a long time, but cannot remove myself as reviewer.
// The fee rate in satoshi/vbyte. | ||
int64 feerate_sat_per_byte = 2 [deprecated = true]; | ||
// The fee rate in satoshi/kweight. | ||
int64 sat_per_kweight = 2; |
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.
I propose to use another ID for this field and not to change the deprecated field, not to break binary backwards compatibility. If someone has an old client and runs against new server (or vice-versa), they can send a request with this field, which has changed meaning, resulting in huge overpayment or underpayment of fee.
Replaces #7443 because a wrong
from
branch was used.For the commands
SendCoins
,SendMany
,CloseChannel
,OpenChannel
,BatchOpenChannel
FundPsbt
,BumpFee
,PendingSweeps
and in the response of theEstimateFee
command the optionsats_per_kweight
is added to allow for more granular control of fees when creating transactions. Commands with the deprecated optionsat_per_byte
are replaced with the new optionsat_per_kweight
. For commands which did not have this option the new one is just added.In the current fee environment one cannot use decimal fee estimates for sats_per_vbyte, therefore using sats_per_kweight one will be able to use decimal sats_per_vbyte feerates indirectly without introducing floating point math.
Currently in the lnd backend the option sats_per_kweight is prioritized in case both options are present at the same time (sats_per_kweight and sats_per_vbyte). Though having both of them set is prevented on
lncli
level. This might be open for discussion.Steps to Test
4 new itests were added.
make itest icase="fundpsbt_feerate"
make itest icase="openchannel_feerate"
make itest icase="sendcoins_feerate"
make itest icase="sendmany_feerate"
1 itest was modified to account for the new option:
make itest icase="cpfp"
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.