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

Add payCommitTxFees flag to LocalParams #2845

Merged
merged 2 commits into from
Jun 12, 2024
Merged

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Mar 29, 2024

The channel initiator traditionnally pays the commit tx fees, but we may want to override that when providing services to wallet users. We thus split the current isInitiator flag into two flags:

  • isChannelOpener
  • payCommitTxFees

We always set payCommitTxFees to the same value as isChannelOpener. Custom feature bits may override that behavior if necessary.

Note that backwards compatibity is preserved since our previous bool8 codec encodes true as 0xff and false as 0x00.

@t-bast t-bast force-pushed the pay-commit-tx-fees-channel-flag branch 3 times, most recently from 3cb219f to d3fbd8e Compare March 29, 2024 10:39
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.42105% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 86.01%. Comparing base (c8184b3) to head (d3fbd8e).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2845      +/-   ##
==========================================
+ Coverage   85.96%   86.01%   +0.04%     
==========================================
  Files         219      219              
  Lines       18441    18441              
  Branches      762      790      +28     
==========================================
+ Hits        15853    15862       +9     
+ Misses       2588     2579       -9     
Files Coverage Δ
...in/scala/fr/acinq/eclair/channel/ChannelData.scala 100.00% <100.00%> (ø)
.../scala/fr/acinq/eclair/channel/ChannelEvents.scala 100.00% <ø> (ø)
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 94.53% <100.00%> (ø)
...inq/eclair/channel/fsm/ChannelOpenDualFunded.scala 87.00% <100.00%> (ø)
...q/eclair/channel/fsm/ChannelOpenSingleFunded.scala 93.52% <100.00%> (ø)
...la/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala 83.55% <100.00%> (ø)
...q/eclair/crypto/keymanager/ChannelKeyManager.scala 87.50% <ø> (ø)
...main/scala/fr/acinq/eclair/db/DbEventHandler.scala 93.58% <100.00%> (ø)
...c/main/scala/fr/acinq/eclair/db/pg/PgAuditDb.scala 99.69% <100.00%> (ø)
...cala/fr/acinq/eclair/db/sqlite/SqliteAuditDb.scala 99.67% <100.00%> (ø)
... and 13 more

... and 4 files with indirect coverage changes

The channel initiator traditionnally pays the commit tx fees, but we may
want to override that when providing services to wallet users. We thus
split the current `isInitiator` flag into two flags:

- `isChannelOpener`
- `payCommitTxFees`

We always set `payCommitTxFees` to the same value as `isChannelOpener`.
Custom feature bits may override that behavior if necessary.

Note that backwards compatibity is preserved since our previous `bool8`
codec encodes `true` as `0xff` and `false` as `0x00`.
@t-bast t-bast force-pushed the pay-commit-tx-fees-channel-flag branch from f58209a to 0dfbfd8 Compare June 7, 2024 14:39
Copy link
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

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

IIUC we:

  • use isChannelOpened:
    • as InteractiveTxParams.isInitiator
    • in the switch-to-zeroconf logic
    • to compute obscuredCommitTxNumber()
    • in the rate limit logic
  • use payCommitTxFees:
    • for commitment tx fees
    • for closing tx fees
    • to decide whether to send update_fee

That LGTM

And `paysClosingFees`.
@t-bast
Copy link
Member Author

t-bast commented Jun 11, 2024

It's also worth noting that this PR is perfectly safe to integrate: we introduce the paysCommitTxFees boolean flag, but there is no way to set it to something else than isChannelOpener (as this should only be set for on-the-fly funding).

@t-bast t-bast merged commit f0e3985 into master Jun 12, 2024
1 check passed
@t-bast t-bast deleted the pay-commit-tx-fees-channel-flag branch June 12, 2024 08:33
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