-
Notifications
You must be signed in to change notification settings - Fork 385
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 MempoolInterface
to add mempool scan
#2404
Conversation
Codecov ReportPatch and project coverage have no change.
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #2404 +/- ##
=======================================
Coverage 90.31% 90.31%
=======================================
Files 106 106
Lines 55166 55166
Branches 55166 55166
=======================================
Hits 49822 49822
Misses 5344 5344 ☔ View full report in Codecov by Sentry. |
This doesn't actually accomplish anything - is there some specific feedback you want? Otherwise we should discuss on #2341 whether we actually want to do this. |
Yes I’m blocked on those questions to work on a concrete implementation (and the
Somehow there is the assumption than a |
Right, my point is before there's something to review the discussion belongs on the issue, rather than as a PR :). More specifically, I'm still not convinced we should do this, I'd appreciate a longer discussion on the linked issue. |
I don’t deny we can benefit from a longer discussion, added a new comment on the issue. I’m thinking we might combine both |
Let's discuss it on the issue and not leave this PR open? I don't like PRs hanging around forever and polluting the PR count :). |
Replied on the issue, if the use-case a) is thought as relevant I'm happy to propose a minimal implementation of it to kick the ball rolling. So good if we can let it open (at least until we disagree mempool scanning is bad idea for all the use-cases I mention on the issue). |
This isn't a PR, this is a discussion starter API draft with no code. Let's discuss it on the issue and we can reopen this when we figure out (a) if we want it and (b) what the API should look like. This PR's full content could easily fit into a comment on that issue :). |
Replied and have a look as I start to be worried you don’t understand Lightning :) |
Local access to the mempool view enables routing hops and LSP to perfom more efficiently two tasks:
ChannelMonitor::get_pending_or_resolved_outbound_htlcs()
)For the first task, if a) our counterparty realizes a force-close and b) there are non-expired received HTLC outputs on the force-closed commitment transaction and c) our counterparty broadcast one or more HTLC-success transactions on those outputs, once those latest transactions are well-propagated on the network mempools, we can fetch the preimage and transmit it to the ChannelManager for pending off-chain inbound HTLCs resolution (i.e sending an
update_fulfill_htlc
to our counterparty on the inbound edge). Liquidity is therefore unlock faster on the inbound edge without having to wait on counterparty's commitment transaction confirmation.For the second task, once we have dual-funding functional, we might accept counterparty's
TxAddInput
in the V2 channel establishment and commit some of our own inputs in the collaborative transaction for liquidity balanced channel opening. However, as long as the channel is not confirmed, we're exposed to double-spend by our counterparty locking up our contributed UTXOs in a liquidity griefing, at the detrimental of others potential dual-funding flows we could enter into.This PR implements #2341 by introducing a
MempoolInterface
. This interface has for now a single methodwatch_outpoint()
, where the implementation should return any in-mempool descendant for the givenOutPoint
. This can be implemented given Bitcoin Core'sgetmempooldescendant
(or I think a very similar rpcgetutxomempooldescendant
that I'll have to land there as a first step).Few integration approaches for a default
MempoolInterface
implementation can be considered:ChainMonitor
?FeeEstimator
orFeeEstimator
and defer implementation to downstream LDK users ?The first option has the advantage to have a more robust and consistent integration if the mempool interface becomes
more complex in function of mempool evolution works on the Core side (e.g package policy or mempool clusters).
Other mempool scanning interfaces approaches can be considered before to make the necesary changes on the Core side to have a functional end-to-end mempool scanning for review.