cnct: add new methods for resolvers

This commit is contained in:
Joost Jager
2019-11-01 11:04:28 +01:00
parent 1e5eec990e
commit 32249cb72e
7 changed files with 102 additions and 98 deletions

View File

@@ -39,6 +39,19 @@ type commitSweepResolver struct {
contractResolverKit
}
// newCommitSweepResolver instantiates a new direct commit output resolver.
func newCommitSweepResolver(res lnwallet.CommitOutputResolution,
broadcastHeight uint32,
chanPoint wire.OutPoint, resCfg ResolverConfig) *commitSweepResolver {
return &commitSweepResolver{
contractResolverKit: *newContractResolverKit(resCfg),
commitResolution: res,
broadcastHeight: broadcastHeight,
chanPoint: chanPoint,
}
}
// ResolverKey returns an identifier which should be globally unique for this
// particular resolver within the chain the original contract resides within.
func (c *commitSweepResolver) ResolverKey() []byte {
@@ -298,15 +311,6 @@ func newCommitSweepResolverFromReader(r io.Reader, resCfg ResolverConfig) (
return c, 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 (c *commitSweepResolver) AttachConfig(r ResolverConfig) {
c.contractResolverKit = *newContractResolverKit(r)
}
// A compile time assertion to ensure commitSweepResolver meets the
// ContractResolver interface.
var _ ContractResolver = (*commitSweepResolver)(nil)