cnct: add new methods for resolvers

This commit is contained in:
Joost Jager committed 2019-11-11 14:35:30 +01:00
1 parent 1e5eec990e
commit 32249cb72e
7 files changed
+102 -98

No files matched your search

+15 -9
View File
@@ -51,6 +51,21 @@ type htlcTimeoutResolver struct {
contractResolverKit
}
// newTimeoutResolver instantiates a new timeout htlc resolver.
func newTimeoutResolver(res lnwallet.OutgoingHtlcResolution,
broadcastHeight uint32, htlcIndex uint64,
htlcAmt lnwire.MilliSatoshi,
resCfg ResolverConfig) *htlcTimeoutResolver {
return &htlcTimeoutResolver{
contractResolverKit: *newContractResolverKit(resCfg),
htlcResolution: res,
broadcastHeight: broadcastHeight,
htlcIndex: htlcIndex,
htlcAmt: htlcAmt,
}
}
// ResolverKey returns an identifier which should be globally unique for this
// particular resolver within the chain the original contract resides within.
//
@@ -441,15 +456,6 @@ func newTimeoutResolverFromReader(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 *htlcTimeoutResolver) AttachConfig(r ResolverConfig) {
h.contractResolverKit = *newContractResolverKit(r)
}
// A compile time assertion to ensure htlcTimeoutResolver meets the
// ContractResolver interface.
var _ ContractResolver = (*htlcTimeoutResolver)(nil)