cnct: move supplement method into resolvers

This commit is contained in:
Joost Jager committed 2019-11-12 14:55:03 +01:00
1 parent 76c2b2cea2
commit a83be177c6
6 files changed
+76 -89

No files matched your search

+17 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
@@ -456,6 +457,21 @@ func newTimeoutResolverFromReader(r io.Reader, resCfg ResolverConfig) (
return h, nil
}
// Supplement adds additional information to the resolver that is required
// before Resolve() is called.
//
// NOTE: Part of the htlcContractResolver interface.
func (h *htlcTimeoutResolver) Supplement(htlc channeldb.HTLC) {
h.htlcAmt = htlc.Amt
}
// HtlcPoint returns the htlc's outpoint on the commitment tx.
//
// NOTE: Part of the htlcContractResolver interface.
func (h *htlcTimeoutResolver) HtlcPoint() wire.OutPoint {
return h.htlcResolution.HtlcPoint()
}
// A compile time assertion to ensure htlcTimeoutResolver meets the
// ContractResolver interface.
var _ ContractResolver = (*htlcTimeoutResolver)(nil)
var _ htlcContractResolver = (*htlcTimeoutResolver)(nil)