contractcourt+lnd: watch for preimage reveal in mempool
This commit extends the current htlc timeout resolver to also watch for preimage spend in mempool for a full node backend. If mempool enabled, the resolver will watch the spend of the htlc output in mempool and blocks **concurrently**, as if they are independent. Ideally, a transaction will first appear in mempool then in a block. However, there's no guarantee it will appear in **our** mempool since there's no global mempool, thus we need to watch the spend in two places in case it doesn't go through our mempool. The current design favors the spend event found in blocks, that is, when the tx is confirmed, we'd abort the monitoring and conitnue since the outpoint cannot be double spent and re-appear in mempool again. This is not true in the rare case of reorg, and we will handle reorg seperately.
This commit is contained in:
3 files changed
+182
-2
No files matched your search
@@ -130,6 +130,10 @@ type ChainArbitratorConfig struct {
|
||||
// certain on-chain events.
|
||||
Notifier chainntnfs.ChainNotifier
|
||||
|
||||
// Mempool is the a mempool watcher that allows us to watch for events
|
||||
// happened in mempool.
|
||||
Mempool chainntnfs.MempoolWatcher
|
||||
|
||||
// Signer is a signer backed by the active lnd node. This should be
|
||||
// capable of producing a signature as specified by a valid
|
||||
// SignDescriptor.
|
||||
|
||||
Reference in new issue
Block a user