type fillBlockHeaderFn func(hash *bc.Hash) (*types.BlockHeader, error)
type fillBlockTransactionsFn func(hash *bc.Hash) ([]*types.Tx, error)
type fillVoteResultFn func(seq uint64) (*state.VoteResult, error)
-type fillHeightIndexFn func(height uint64) ([]*bc.Hash, error)
+type fillBlockHashesFn func(height uint64) ([]*bc.Hash, error)
type fillMainChainHashFn func(height uint64) (*bc.Hash, error)
-func newCache(fillBlockHeader fillBlockHeaderFn, fillBlockTxs fillBlockTransactionsFn, fillVoteResult fillVoteResultFn, fillHeightIndex fillHeightIndexFn, fillMainChainHash fillMainChainHashFn) cache {
+func newCache(fillBlockHeader fillBlockHeaderFn, fillBlockTxs fillBlockTransactionsFn, fillVoteResult fillVoteResultFn, fillBlockHashes fillBlockHashesFn, fillMainChainHash fillMainChainHashFn) cache {
return cache{
lruBlockHeaders: common.NewCache(maxCachedBlockHeaders),
lruBlockTxs: common.NewCache(maxCachedBlockTransactions),
fillBlockHeaderFn: fillBlockHeader,
fillBlockTransactionFn: fillBlockTxs,
fillVoteResultFn: fillVoteResult,
- fillHeightIndexFn: fillHeightIndex,
+ fillBlockHashesFn: fillBlockHashes,
fillMainChainHashFn: fillMainChainHash,
}
}
fillBlockHeaderFn func(hash *bc.Hash) (*types.BlockHeader, error)
fillBlockTransactionFn func(hash *bc.Hash) ([]*types.Tx, error)
fillVoteResultFn func(seq uint64) (*state.VoteResult, error)
- fillHeightIndexFn func(uint64) ([]*bc.Hash, error)
+ fillBlockHashesFn func(uint64) ([]*bc.Hash, error)
fillMainChainHashFn func(uint64) (*bc.Hash, error)
sf singleflight.Group
heightStr := strconv.FormatUint(height, 10)
hashes, err := c.sf.Do("BlockHashesByHeight:"+heightStr, func() (interface{}, error) {
- hashes, err := c.fillHeightIndexFn(height)
+ hashes, err := c.fillBlockHashesFn(height)
if err != nil {
return nil, err
}