+ c.lruConsensusResults.Add(consensusResult.Seq, consensusResult)
+ return consensusResult, nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return consensusResult.(*state.ConsensusResult).Fork(), nil
+}
+
+func (c *cache) lookupMainChainHash(height uint64) (*bc.Hash, error) {
+ if hash, ok := c.lruMainChainHashes.Get(height); ok {
+ return hash.(*bc.Hash), nil
+ }
+
+ heightStr := strconv.FormatUint(height, 10)
+ hash, err := c.sf.Do("BlockHashByHeight:"+heightStr, func() (interface{}, error) {
+ hash, err := c.fillMainChainHashFn(height)
+ if err != nil {
+ return nil, err