cnct: add new methods for resolvers
This commit is contained in:
7 files changed
+102
-98
No files matched your search
@@ -5,6 +5,8 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
// htlcOutgoingContestResolver is a ContractResolver that's able to resolve an
|
||||
@@ -18,6 +20,21 @@ type htlcOutgoingContestResolver struct {
|
||||
htlcTimeoutResolver
|
||||
}
|
||||
|
||||
// newOutgoingContestResolver instantiates a new outgoing contested htlc
|
||||
// resolver.
|
||||
func newOutgoingContestResolver(res lnwallet.OutgoingHtlcResolution,
|
||||
broadcastHeight uint32, htlcIndex uint64, htlcAmt lnwire.MilliSatoshi,
|
||||
resCfg ResolverConfig) *htlcOutgoingContestResolver {
|
||||
|
||||
timeout := newTimeoutResolver(
|
||||
res, broadcastHeight, htlcIndex, htlcAmt, resCfg,
|
||||
)
|
||||
|
||||
return &htlcOutgoingContestResolver{
|
||||
htlcTimeoutResolver: *timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve commences the resolution of this contract. As this contract hasn't
|
||||
// yet timed out, we'll wait for one of two things to happen
|
||||
//
|
||||
@@ -196,15 +213,6 @@ func newOutgoingContestResolverFromReader(r io.Reader, resCfg ResolverConfig) (
|
||||
return h, nil
|
||||
}
|
||||
|
||||
// AttachConfig should be called once a resolved is successfully decoded from
|
||||
// its stored format. This struct delivers the configuration items that
|
||||
// resolvers need to complete their duty.
|
||||
//
|
||||
// NOTE: Part of the ContractResolver interface.
|
||||
func (h *htlcOutgoingContestResolver) AttachConfig(r ResolverConfig) {
|
||||
h.htlcTimeoutResolver.AttachConfig(r)
|
||||
}
|
||||
|
||||
// A compile time assertion to ensure htlcOutgoingContestResolver meets the
|
||||
// ContractResolver interface.
|
||||
var _ ContractResolver = (*htlcOutgoingContestResolver)(nil)
|
||||
Reference in new issue
Block a user