cnct: do not persist stateless resolvers
Preparation for the anchor resolver which does not have persistent state.
This commit is contained in:
parent
d2b6472843
commit
07a39b1ebf
@ -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())
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user