Uh oh!
There was an error while loading. Please reload this page.
Include base input fee in fee, in calculate_our_funding_satoshis() - #3558
Conversation
optout21
commented
Jan 24, 2025
Note: #3407 also include this change, I will take care of merge if needed regardless of which PR is merged first. |
4a4ae72 to
27784d9CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dunxen
left a comment
There was a problem hiding this comment.
Basically LGTM, modulo Jeff's remaining comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
085455d to
61131beCompareoptout21
commented
Jan 30, 2025
Please consider for merging. |
jkczyz
left a comment
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
61131be to
95f1e9cCompareoptout21
commented
Jan 30, 2025
Commits reorganized |
jkczyz
left a comment
There was a problem hiding this comment.
Please update PR description.
wpaulino
left a comment
There was a problem hiding this comment.
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).
Uh oh!
There was an error while loading. Please reload this page.
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. |
wpaulino
commented
Jan 31, 2025
Let's just delete |
Here's my conclusion:
|
95f1e9c to
c3354b7CompareCodecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #3558 +/- ##
==========================================
+ Coverage 88.53% 89.98% +1.44%
==========================================
Files 149 149 Lines 114985 130021 +15036 Branches 114985 130021 +15036 ==========================================
+ Hits 101803 116998 +15195 + Misses 10693 10619 -74 + Partials 2489 2404 -85 ☔ View full report in Codecov by Sentry. |
c3354b7 to
f43c7c2Compare
Should this say #3407? |
Of course, my bad, corrected |
jkczyz
commented
Jan 31, 2025
@wpaulino If you're ok with this then I'd say we just squash this PR into one commit. |
wpaulino
commented
Feb 4, 2025
Yeah looks good, let's keep two commits though: one removing the dead code, and another with the bug fix. |
f43c7c2 to
05c38eeCompareoptout21
commented
Feb 5, 2025
Squashed into the two commits. |
wpaulino
left a comment
There was a problem hiding this comment.
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
Uh oh!
There was an error while loading. Please reload this page.
05c38ee to
45776d3Compare45776d3 to
f61cdbeComparef61cdbe to
d4de817Compareoptout21
commented
Feb 7, 2025
Noted, commit msg/desc adjusted. |
jkczyz
commented
Feb 10, 2025
LGTM, but looks like the commit descriptions are still over 72 characters. Could you re-wrap? FYI, we should use these guidelines: https://cbea.ms/git-commit/. |
The base input fee was missing in calculate_our_funding_satoshis(), it is added now; also add unit test.
6be2e8a to
2bb7aa2Compareoptout21
commented
Feb 11, 2025
Commit msgs adjusted! |
Uh oh!
There was an error while loading. Please reload this page.
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).
2bb7aa2 to
c29ec0fCompare
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),