mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
Merge pull request #614 from nspcc-dev/configurable-mempool-size
config: add MemPoolSize configuration parameter
This commit is contained in:
commit
eb59460032
11 changed files with 17 additions and 1 deletions
|
@ -47,6 +47,7 @@ type (
|
||||||
SecondsPerBlock int `yaml:"SecondsPerBlock"`
|
SecondsPerBlock int `yaml:"SecondsPerBlock"`
|
||||||
LowPriorityThreshold float64 `yaml:"LowPriorityThreshold"`
|
LowPriorityThreshold float64 `yaml:"LowPriorityThreshold"`
|
||||||
MaxTransactionsPerBlock int64 `yaml:"MaxTransactionsPerBlock"`
|
MaxTransactionsPerBlock int64 `yaml:"MaxTransactionsPerBlock"`
|
||||||
|
MemPoolSize int `yaml:"MemPoolSize"`
|
||||||
StandbyValidators []string `yaml:"StandbyValidators"`
|
StandbyValidators []string `yaml:"StandbyValidators"`
|
||||||
SeedList []string `yaml:"SeedList"`
|
SeedList []string `yaml:"SeedList"`
|
||||||
SystemFee SystemFee `yaml:"SystemFee"`
|
SystemFee SystemFee `yaml:"SystemFee"`
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.001
|
LowPriorityThreshold: 0.001
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c
|
- 03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c
|
||||||
- 02df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093
|
- 02df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 1
|
SecondsPerBlock: 1
|
||||||
LowPriorityThreshold: 0.001
|
LowPriorityThreshold: 0.001
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
SeedList:
|
SeedList:
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 0327da12b5c40200e9f65569476bbff2218da4f32548ff43b6387ec1416a231ee8
|
- 0327da12b5c40200e9f65569476bbff2218da4f32548ff43b6387ec1416a231ee8
|
||||||
- 026ce35b29147ad09e4afe4ec4a7319095f08198fa8babbe3c56e970b143528d22
|
- 026ce35b29147ad09e4afe4ec4a7319095f08198fa8babbe3c56e970b143528d22
|
||||||
|
|
|
@ -3,6 +3,7 @@ ProtocolConfiguration:
|
||||||
AddressVersion: 23
|
AddressVersion: 23
|
||||||
SecondsPerBlock: 15
|
SecondsPerBlock: 15
|
||||||
LowPriorityThreshold: 0.000
|
LowPriorityThreshold: 0.000
|
||||||
|
MemPoolSize: 50000
|
||||||
StandbyValidators:
|
StandbyValidators:
|
||||||
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
|
||||||
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
|
||||||
|
|
|
@ -37,6 +37,8 @@ const (
|
||||||
// contain any relationship between the two, so we should follow this
|
// contain any relationship between the two, so we should follow this
|
||||||
// behavior.
|
// behavior.
|
||||||
registeredAssetLifetime = 2 * 2000000
|
registeredAssetLifetime = 2 * 2000000
|
||||||
|
|
||||||
|
defaultMemPoolSize = 50000
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -95,6 +97,10 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L
|
||||||
return nil, errors.New("empty logger")
|
return nil, errors.New("empty logger")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.MemPoolSize <= 0 {
|
||||||
|
cfg.MemPoolSize = defaultMemPoolSize
|
||||||
|
log.Info("mempool size is not set or wrong, setting default value", zap.Int("MemPoolSize", cfg.MemPoolSize))
|
||||||
|
}
|
||||||
bc := &Blockchain{
|
bc := &Blockchain{
|
||||||
config: cfg,
|
config: cfg,
|
||||||
dao: newDao(s),
|
dao: newDao(s),
|
||||||
|
@ -102,7 +108,7 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L
|
||||||
headersOpDone: make(chan struct{}),
|
headersOpDone: make(chan struct{}),
|
||||||
stopCh: make(chan struct{}),
|
stopCh: make(chan struct{}),
|
||||||
runToExitCh: make(chan struct{}),
|
runToExitCh: make(chan struct{}),
|
||||||
memPool: mempool.NewMemPool(50000),
|
memPool: mempool.NewMemPool(cfg.MemPoolSize),
|
||||||
keyCache: make(map[util.Uint160]map[string]*keys.PublicKey),
|
keyCache: make(map[util.Uint160]map[string]*keys.PublicKey),
|
||||||
log: log,
|
log: log,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue