-
Notifications
You must be signed in to change notification settings - Fork 378
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
Include base input fee in fee, in calculate_our_funding_satoshis() #3558
base: main
Are you sure you want to change the base?
Conversation
Note: #3407 also include this change, I will take care of merge if needed regardless of which PR is merged first. |
4a4ae72
to
27784d9
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.
Basically LGTM, modulo Jeff's remaining comments.
085455d
to
61131be
Compare
Please consider for merging. |
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.
Could you re-organize the commits a bit? Let's do two commits where the first one contains the the base input fee fix and the new test. The second commit can contain the refactor and related test changes.
61131be
to
95f1e9c
Compare
Commits reorganized |
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.
Please update PR description.
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 had a look at how calculate_our_funding_satoshis
is used and I'm a bit confused. For an inbound channel, we should have the user provide us the amount they want to contribute, along with the inputs, and we should make sure the inputs provided can cover their intended contribution amount after fees, etc. We shouldn't assume the user always wants to contribute as much as possible from their inputs (e.g., like send-all in an onchain wallet). So we basically want two modes: ContributeAll(inputs)
and ContributeAmount(amount, inputs, change_address)
.
I'm also a bit confused. The method computes the contributed inputs minus the proportional fees, that is, how much we could contribute to the funding with these inputs. If that's below dust, it means these inputs make no economic sense (BTW the error message is not very specific). As currently there is no way to specify contributing inputs on the acceptor side, this logic is currently irrelevant. V2 opening as initiator is still missing entirely (still only in PR). I made this spin-off to separate just the one-liner estimation fix. |
Let's just delete |
Here's my conclusion:
|
95f1e9c
to
c3354b7
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3558 +/- ##
==========================================
+ Coverage 88.53% 88.92% +0.39%
==========================================
Files 149 149
Lines 114475 116677 +2202
Branches 114475 116677 +2202
==========================================
+ Hits 101347 103757 +2410
+ Misses 10634 10453 -181
+ Partials 2494 2467 -27 ☔ View full report in Codecov by Sentry. |
c3354b7
to
f43c7c2
Compare
Should this say #3407? |
Of course, my bad, corrected |
@wpaulino If you're ok with this then I'd say we just squash this PR into one commit. |
Yeah looks good, let's keep two commits though: one removing the dead code, and another with the bug fix. |
f43c7c2
to
05c38ee
Compare
Squashed into the two commits. |
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.
Sorry, last few nits: please keep commit messages to 72 characters max and include the rationale behind dropping calculate_our_funding_satoshis
in the commit message
05c38ee
to
45776d3
Compare
45776d3
to
f61cdbe
Compare
This method does not take into the intended funding amount, and it's not currently used, therefore it's removed now. Its fee estimation part is kept (estimate_v2_funding_transaction_fee).
f61cdbe
to
d4de817
Compare
Noted, commit msg/desc adjusted. |
It was found that the (still-unused)
calculate_our_funding_satoshis()
method doesn't take into account the base weight of the inputs in the fee estimation.It was also found that this method also misses the intended funding amount.
This change:
calculate_our_funding_satoshis()
into two,estimate_funding_transaction_fee()
, and the output calculation. This is to allow using funding tx fee estimation, needed also by splicing (see [Splicing] Partial, handle splice_init & splice_ack messages #3407).calculate_our_funding_satoshis()
, as it's not used and misses the intended funding amount.Note: this was triggered by work on splicing (#3407),