fix: panic if TriesInMemory is 1 to 2

pull/4377/head
Sun Hyuk Ahn 2 years ago committed by Casey Gardiner
parent 6dfcd51ba3
commit b51be8bea3
  1. 4
      cmd/harmony/flags.go
  2. 2
      core/blockchain_impl.go

@ -408,8 +408,8 @@ func applyGeneralFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig)
if cli.IsFlagChanged(cmd, triesInMemoryFlag) {
value := cli.GetIntFlagValue(cmd, triesInMemoryFlag)
if value <= 1 {
panic("Must number greater than 1 for txpool.accountslots")
if value <= 2 {
panic("Must provide number greater than 2 for General.TriesInMemory")
}
config.General.TriesInMemory = value
}

@ -1071,7 +1071,7 @@ func (bc *BlockChainImpl) Stop() {
// We're writing three different states to catch different restart scenarios:
// - HEAD: So we don't need to reprocess any blocks in the general case
// - HEAD-1: So we don't do large reorgs if our HEAD becomes an uncle
// - HEAD-127: So we have a hard limit on the number of blocks reexecuted
// - HEAD-TriesInMemory: So we have a configurable hard limit on the number of blocks reexecuted (default 128)
if !bc.cacheConfig.Disabled {
triedb := bc.stateCache.TrieDB()

Loading…
Cancel
Save