github.com/iotexproject/iotex-core@v1.14.1-rc1/actpool/config.go (about) 1 package actpool 2 3 import ( 4 "math/big" 5 "time" 6 7 "github.com/iotexproject/iotex-core/pkg/log" 8 "github.com/iotexproject/iotex-core/pkg/unit" 9 ) 10 11 var ( 12 // DefaultConfig is the default config for actpool 13 DefaultConfig = Config{ 14 MaxNumActsPerPool: 32000, 15 MaxGasLimitPerPool: 320000000, 16 MaxNumActsPerAcct: 2000, 17 WorkerBufferSize: 2000, 18 ActionExpiry: 10 * time.Minute, 19 MinGasPriceStr: big.NewInt(unit.Qev).String(), 20 BlackList: []string{}, 21 } 22 ) 23 24 // Config is the actpool config 25 type Config struct { 26 // MaxNumActsPerPool indicates maximum number of actions the whole actpool can hold 27 MaxNumActsPerPool uint64 `yaml:"maxNumActsPerPool"` 28 // MaxGasLimitPerPool indicates maximum gas limit the whole actpool can hold 29 MaxGasLimitPerPool uint64 `yaml:"maxGasLimitPerPool"` 30 // MaxNumActsPerAcct indicates maximum number of actions an account queue can hold 31 MaxNumActsPerAcct uint64 `yaml:"maxNumActsPerAcct"` 32 // WorkerBufferSize indicates the buffer size for each worker's job queue 33 WorkerBufferSize uint64 `yaml:"bufferPerAcct"` 34 // ActionExpiry defines how long an action will be kept in action pool. 35 ActionExpiry time.Duration `yaml:"actionExpiry"` 36 // MinGasPriceStr defines the minimal gas price the delegate will accept for an action 37 MinGasPriceStr string `yaml:"minGasPrice"` 38 // BlackList lists the account address that are banned from initiating actions 39 BlackList []string `yaml:"blackList"` 40 } 41 42 // MinGasPrice returns the minimal gas price threshold 43 func (ap Config) MinGasPrice() *big.Int { 44 mgp, ok := new(big.Int).SetString(ap.MinGasPriceStr, 10) 45 if !ok { 46 log.S().Panicf("Error when parsing minimal gas price string: %s", ap.MinGasPriceStr) 47 } 48 return mgp 49 }