github.com/turingchain2020/turingchain@v1.1.21/system/mempool/timeline/timeline.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found In the LICENSE file. 4 5 package timeline 6 7 import ( 8 "github.com/turingchain2020/turingchain/queue" 9 drivers "github.com/turingchain2020/turingchain/system/mempool" 10 "github.com/turingchain2020/turingchain/types" 11 ) 12 13 func init() { 14 drivers.Reg("timeline", New) 15 } 16 17 //New 创建timeline cache 结构的 mempool 18 func New(cfg *types.Mempool, sub []byte) queue.Module { 19 c := drivers.NewMempool(cfg) 20 var subcfg drivers.SubConfig 21 types.MustDecode(sub, &subcfg) 22 if subcfg.PoolCacheSize == 0 { 23 subcfg.PoolCacheSize = cfg.PoolCacheSize 24 } 25 if subcfg.ProperFee == 0 { 26 subcfg.ProperFee = cfg.MinTxFeeRate 27 } 28 c.SetQueueCache(drivers.NewSimpleQueue(subcfg)) 29 return c 30 }