contractcourt: specify deadline and budget for htlc timeout

This commit is contained in:
yyforyongyu
2024-03-19 10:36:00 +08:00
parent d1ad07fa21
commit cab180a52e
8 changed files with 214 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn"
)
var (
@@ -20,10 +21,6 @@ const (
// sweepConfTarget is the default number of blocks that we'll use as a
// confirmation target when sweeping.
sweepConfTarget = 6
// secondLevelConfTarget is the confirmation target we'll use when
// adding fees to our second-level HTLC transactions.
secondLevelConfTarget = 6
)
// ContractResolver is an interface which packages a state machine which is
@@ -75,6 +72,10 @@ type htlcContractResolver interface {
// Supplement adds additional information to the resolver that is
// required before Resolve() is called.
Supplement(htlc channeldb.HTLC)
// SupplementDeadline gives the deadline height for the HTLC output.
// This is only useful for outgoing HTLCs.
SupplementDeadline(deadlineHeight fn.Option[int32])
}
// reportingContractResolver is a ContractResolver that also exposes a report on