MCPcopy Create free account
hub / github.com/33cn/chain33 / initTxHashCache

Function initTxHashCache

blockchain/cache_test.go:54–66  ·  view source on GitHub ↗
(txHeightRange int64)

Source from the content-addressed store, hash-verified

52}
53
54func initTxHashCache(txHeightRange int64) (*txHashCache, *BlockChain, *types.Chain33Config) {
55 cfg := types.NewChain33Config(types.GetDefaultCfgstring())
56 cfg.GetModuleConfig().BlockChain.DefCacheSize = txHeightRange * 4
57 chain := New(cfg)
58 chain.blockStore = &BlockStore{blockCache: chain.blockCache}
59 q := queue.New("channel")
60 q.SetConfig(cfg)
61 chain.client = q.Client()
62 cache := newTxHashCache(chain, txHeightRange, txHeightRange)
63 chain.txHeightCache = cache
64 return cache, chain, cfg
65
66}
67
68func newTestTxs(cfg *types.Chain33Config, priv crypto.PrivKey, currHeight, txHeightRange int64) []*types.Transaction {
69

Callers 3

TestTxHashCache_AddFunction · 0.85
TestTxHashCache_DelFunction · 0.85
TestTxHashCache_ContainsFunction · 0.85

Calls 8

GetModuleConfigMethod · 0.95
NewChain33ConfigFunction · 0.92
GetDefaultCfgstringFunction · 0.92
NewFunction · 0.92
newTxHashCacheFunction · 0.85
NewFunction · 0.70
SetConfigMethod · 0.65
ClientMethod · 0.65

Tested by

no test coverage detected