-
Notifications
You must be signed in to change notification settings - Fork 265
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
Rework TxPublisher #1844
Rework TxPublisher #1844
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1844 +/- ##
==========================================
- Coverage 89.09% 88.95% -0.14%
==========================================
Files 146 150 +4
Lines 10994 11219 +225
Branches 444 472 +28
==========================================
+ Hits 9795 9980 +185
- Misses 1199 1239 +40
|
1f1e473
to
b979972
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.
Part of what makes this PR interesting is that the seemingly simple task of funding and publishing transactions is much -much- more complicated than it appears. That's why I believe this architecture is right even if it looks over-engineered at first glance (especially the *Monitor
actors).
The implementation of some of the actors is pretty complex (looking at ReplaceableTxPublisher
), but I don't see a way around that, and we still manage to have a well defined, simple interface with those actors.
I'm going to do a review-by-testing now.
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/TxPublisher.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/TxPublisher.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/TxPublisher.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/TxPublisher.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/RawTxPublisher.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/MempoolTxMonitor.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/MempoolTxMonitor.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/MempoolTxMonitor.scala
Outdated
Show resolved
Hide resolved
Splt the TxPublisher in many smaller actors with clear responsibilities. Each tx publishing attempt is its own actor and watches the tx until it either confirms or becomes evicted, and reports the result to its parent. The TxPublisher (one per channel) orchestrates publishing attempts and will in the future decide to RBF txs based on deadline information.
6c98a54
to
fb1dd6f
Compare
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/RawTxPublisher.scala
Show resolved
Hide resolved
SpentConfirmed and SpentUnconfirmed should be mutually exclusive.
🎉 |
This PR is an alternative approach to #1827
It contains more architectural changes (and more code to review) but is a cleaner design and will make automatic RBF much simpler to add.
The high-level architecture is the following:
There is one
TxPublisher
per channel. The channel tells it to publish transactions (and in the future will give it deadline instructions). TheTxPublisher
creates child actors (RawTxPublisher
/ReplaceableTxPublisher
) for each transaction publishing attempts and waits for them to report the result and schedule a retry if necessary.A
RawTxPublisher
simply publishes a complete transaction without modifying it.A
ReplaceableTxPublisher
will add inputs to match the desired feerate and publish the resulting transaction.Internally, they use a
TxTimeLockMonitor
that checks CLTV and CSV delays, and aMempoolTxMonitor
that regularly checks if its transaction confirms or is rejected from the mempool.NB: it's worth turning on
debug
logs for thefr.acinq.eclair.channel.publish
package to troubleshoot potential issues with this new publishing mechanism.