mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-20 04:21:37 +02:00
contractcourt+server: settle invoice for on-chain HTLC sweep
In this commit, we extend the htlcSuccessResolver to settle the invoice, if any, of the corresponding on-chain HTLC sweep. This ensures that the invoice state is consistent as when claiming the HTLC "off-chain".
This commit is contained in:
@@ -6,8 +6,6 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
@@ -15,6 +13,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
)
|
||||
|
||||
// ErrChainArbExiting signals that the chain arbitrator is shutting down.
|
||||
@@ -135,6 +134,11 @@ type ChainArbitratorConfig struct {
|
||||
|
||||
// Sweeper allows resolvers to sweep their final outputs.
|
||||
Sweeper *sweep.UtxoSweeper
|
||||
|
||||
// SettleInvoice attempts to settle an existing invoice on-chain with
|
||||
// the given payment hash. ErrInvoiceNotFound is returned if an invoice
|
||||
// is not found.
|
||||
SettleInvoice func(chainhash.Hash, lnwire.MilliSatoshi) error
|
||||
}
|
||||
|
||||
// ChainArbitrator is a sub-system that oversees the on-chain resolution of all
|
||||
|
Reference in New Issue
Block a user