-
Notifications
You must be signed in to change notification settings - Fork 268
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
Conversation
b2cf365
to
ab70d6f
Compare
ab70d6f
to
8056fa9
Compare
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
f63bef6
to
7b43477
Compare
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).
7b43477
to
ba5a730
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.
First pass.
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/CommonHandlers.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ChannelOpenSingleFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ChannelOpenSingleFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ChannelOpenSingleFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ChannelOpenDualFunded.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
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 Report
@@ 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
|
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.
The send
/receive
ping-pong is really neat. Yay simple protocols!
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
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.
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.
InteractiveTxBuilderSpec
is really nice, just one nit and we are good to go.
After exchanging
open_channel2
andaccept_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).