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

Implement the interactive-tx protocol #2273

Merged
merged 12 commits into from
Aug 12, 2022
Merged

Implement the interactive-tx protocol #2273

merged 12 commits into from
Aug 12, 2022

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented May 17, 2022

After exchanging open_channel2 and accept_channel2, we start building the funding transaction with the interactive-tx protocol.

We stop once we've generated our signatures for the funding transaction, at which point we should store the channel in the DB (which will be done in future commits).

@t-bast t-bast force-pushed the dual-funding-created branch from b2cf365 to ab70d6f Compare May 17, 2022 09:20
@t-bast t-bast requested a review from pm47 May 18, 2022 07:54
@t-bast t-bast force-pushed the dual-funding-created branch from ab70d6f to 8056fa9 Compare May 19, 2022 10:04
@t-bast t-bast force-pushed the dual-funding-created branch 4 times, most recently from f63bef6 to 7b43477 Compare July 1, 2022 14:50
After exchanging `open_channel2` and `accept_channel2`, we start building
the funding transaction.

We stop once we've generated our signatures for the funding transaction,
at which point we should store the channel in the DB (which will be done in
future commits).
@t-bast t-bast force-pushed the dual-funding-created branch from 7b43477 to ba5a730 Compare August 9, 2022 15:18
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.

First pass.

t-bast added 5 commits August 11, 2022 09:59
Otherwise there is a risk of losing state in reorgs.
For inputs that can't be used in the interactive-tx construction.
We explicitly handle the case where bitcoind incorrectly reuses unusable
inputs that we locked, otherwise we could go into an infinite funding loop.
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #2273 (22a21a2) into master (0310bf5) will increase coverage by 0.00%.
The diff coverage is 85.74%.

@@           Coverage Diff            @@
##           master    #2273    +/-   ##
========================================
  Coverage   84.84%   84.85%            
========================================
  Files         195      198     +3     
  Lines       14850    15255   +405     
  Branches      609      633    +24     
========================================
+ Hits        12600    12945   +345     
- Misses       2250     2310    +60     
Impacted Files Coverage Δ
...in/scala/fr/acinq/eclair/channel/fsm/Channel.scala 87.47% <ø> (-0.12%) ⬇️
...inq/eclair/channel/fsm/SingleFundingHandlers.scala 84.09% <42.85%> (ø)
...acinq/eclair/channel/fsm/DualFundingHandlers.scala 57.14% <57.14%> (ø)
...q/eclair/wire/protocol/LightningMessageTypes.scala 94.11% <62.50%> (-3.67%) ⬇️
...fr/acinq/eclair/channel/InteractiveTxBuilder.scala 85.54% <85.54%> (ø)
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 94.81% <90.90%> (-0.36%) ⬇️
...inq/eclair/channel/fsm/ChannelOpenDualFunded.scala 97.05% <94.82%> (+5.67%) ⬆️
...ala/fr/acinq/eclair/blockchain/OnChainWallet.scala 100.00% <100.00%> (ø)
...ir/blockchain/bitcoind/rpc/BitcoinCoreClient.scala 96.36% <100.00%> (+0.06%) ⬆️
...in/scala/fr/acinq/eclair/channel/ChannelData.scala 100.00% <100.00%> (ø)
... and 17 more

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.

The send/receive ping-pong is really neat. Yay simple protocols!

t-bast added 5 commits August 12, 2022 11:40
Except:

- use stash instead of message timer delays
- investigate non-initiator fees tweaking

Those two deserve their own commit.
When we have change output, it's easy to discount the fees for the common
fields.
Explicitly handle cases where bitcoind returns an invalid funded transaction.
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.

InteractiveTxBuilderSpec is really nice, just one nit and we are good to go.

@t-bast t-bast merged commit 33e6fac into master Aug 12, 2022
@t-bast t-bast deleted the dual-funding-created branch August 12, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants