diff --git a/contractcourt/briefcase.go b/contractcourt/briefcase.go index 6a3bfa8b..1114f6db 100644 --- a/contractcourt/briefcase.go +++ b/contractcourt/briefcase.go @@ -372,6 +372,13 @@ func fetchContractWriteBucket(tx *bbolt.Tx, scopeKey []byte) (*bbolt.Bucket, err func (b *boltArbitratorLog) writeResolver(contractBucket *bbolt.Bucket, res ContractResolver) error { + // Only persist resolvers that are stateful. Stateless resolvers don't + // expose a resolver key. + resKey := res.ResolverKey() + if resKey == nil { + return nil + } + // First, we'll write to the buffer the type of this resolver. Using // this byte, we can later properly deserialize the resolver properly. var ( @@ -400,8 +407,6 @@ func (b *boltArbitratorLog) writeResolver(contractBucket *bbolt.Bucket, return err } - resKey := res.ResolverKey() - return contractBucket.Put(resKey, buf.Bytes()) } diff --git a/contractcourt/channel_arbitrator_test.go b/contractcourt/channel_arbitrator_test.go index b78f3c31..dcf969e9 100644 --- a/contractcourt/channel_arbitrator_test.go +++ b/contractcourt/channel_arbitrator_test.go @@ -83,6 +83,11 @@ func (b *mockArbitratorLog) InsertUnresolvedContracts( b.Lock() for _, resolver := range resolvers { + resKey := resolver.ResolverKey() + if resKey == nil { + continue + } + b.resolvers[resolver] = struct{}{} } b.Unlock()