Skip to content
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

Clarify commit tx fee anchor cost #1721

Merged
merged 3 commits into from
Mar 24, 2021
Merged

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Mar 5, 2021

Since anchor outputs, we not only deduce the commit tx fee from the funder's main output but the cost of the anchors as well.
We rename the function that does that for more clarity as it came up in multiple reviews as something that was a bit confusing.

The change is split in two commits to make it easier to verify that there's no regression:

  • the first commit renames the function
  • the second commit adapts places where we actually only want the commit tx fee

Since anchor outputs, we not only deduce the commit tx fee from the funder's
main output but the cost of the anchors as well.

We rename the function that does that for more clarity.
In some tests, we're only interested in the commit tx fee, not the cost
of the anchors.
@t-bast t-bast requested a review from pm47 March 5, 2021 14:16
* If you are adding multiple fees together for example, you should always add them in MilliSatoshi and then round
* down to Satoshi.
*/
def toDeduceFromFunderOutputMsat(dustLimit: Satoshi, spec: CommitmentSpec, commitmentFormat: CommitmentFormat): MilliSatoshi = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would have gone with commitTxFeeMsat and commitTxTotalCostMsat

Suggested change
def toDeduceFromFunderOutputMsat(dustLimit: Satoshi, spec: CommitmentSpec, commitmentFormat: CommitmentFormat): MilliSatoshi = {
def commitTxTotalCostMsat(dustLimit: Satoshi, spec: CommitmentSpec, commitmentFormat: CommitmentFormat): MilliSatoshi = {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 856f427

@codecov-io
Copy link

Codecov Report

Merging #1721 (856f427) into master (afa378f) will increase coverage by 0.35%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1721      +/-   ##
==========================================
+ Coverage   86.30%   86.65%   +0.35%     
==========================================
  Files         151      154       +3     
  Lines       11701    11988     +287     
  Branches      501      511      +10     
==========================================
+ Hits        10098    10388     +290     
+ Misses       1603     1600       -3     
Impacted Files Coverage Δ
...in/scala/fr/acinq/eclair/channel/Commitments.scala 93.57% <100.00%> (ø)
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 95.70% <100.00%> (-0.73%) ⬇️
...la/fr/acinq/eclair/transactions/Transactions.scala 97.42% <100.00%> (+0.62%) ⬆️
.../scala/fr/acinq/eclair/payment/PaymentEvents.scala 97.61% <0.00%> (-2.39%) ⬇️
...main/scala/fr/acinq/eclair/router/Validation.scala 90.76% <0.00%> (-1.54%) ⬇️
...nq/eclair/blockchain/electrum/ElectrumClient.scala 73.52% <0.00%> (-0.37%) ⬇️
...ain/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala 95.94% <0.00%> (-0.36%) ⬇️
...a/fr/acinq/eclair/db/sqlite/SqliteChannelsDb.scala 95.94% <0.00%> (-0.36%) ⬇️
...ir-core/src/main/scala/fr/acinq/eclair/Setup.scala 70.83% <0.00%> (ø)
... and 52 more

@t-bast t-bast merged commit f202587 into master Mar 24, 2021
@t-bast t-bast deleted the clarify-commit-tx-fee-anchor-cost branch March 24, 2021 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants