github.com/turingchain2020/turingchain@v1.1.21/mempool/mempool.go (about)

     1  package mempool
     2  
     3  import (
     4  	"github.com/turingchain2020/turingchain/queue"
     5  	"github.com/turingchain2020/turingchain/system/mempool"
     6  	"github.com/turingchain2020/turingchain/types"
     7  )
     8  
     9  // New new mempool queue module
    10  func New(cfg *types.TuringchainConfig) queue.Module {
    11  	mcfg := cfg.GetModuleConfig().Mempool
    12  	sub := cfg.GetSubConfig().Mempool
    13  	con, err := mempool.Load(mcfg.Name)
    14  	if err != nil {
    15  		panic("Unsupported mempool type:" + mcfg.Name + " " + err.Error())
    16  	}
    17  	subcfg, ok := sub[mcfg.Name]
    18  	if !ok {
    19  		subcfg = nil
    20  	}
    21  	obj := con(mcfg, subcfg)
    22  	return obj
    23  }