drop mempool_reap. use block_size=-1 instead
This commit is contained in:
parent
085b3bc1f2
commit
94f3d201e1
|
@ -79,7 +79,6 @@ func GetConfig(rootDir string) cfg.Config {
|
||||||
mapConfig.SetDefault("timeout_commit", 1000)
|
mapConfig.SetDefault("timeout_commit", 1000)
|
||||||
mapConfig.SetDefault("mempool_recheck", true)
|
mapConfig.SetDefault("mempool_recheck", true)
|
||||||
mapConfig.SetDefault("mempool_broadcast", true)
|
mapConfig.SetDefault("mempool_broadcast", true)
|
||||||
mapConfig.SetDefault("mempool_reap", true)
|
|
||||||
|
|
||||||
return mapConfig
|
return mapConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,6 @@ func GetConfig(rootDir string) cfg.Config {
|
||||||
mapConfig.SetDefault("timeout_commit", 1)
|
mapConfig.SetDefault("timeout_commit", 1)
|
||||||
mapConfig.SetDefault("mempool_recheck", true)
|
mapConfig.SetDefault("mempool_recheck", true)
|
||||||
mapConfig.SetDefault("mempool_broadcast", true)
|
mapConfig.SetDefault("mempool_broadcast", true)
|
||||||
mapConfig.SetDefault("mempool_reap", true)
|
|
||||||
|
|
||||||
return mapConfig
|
return mapConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -877,11 +877,16 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maxBlockSize := config.GetInt("block_size")
|
||||||
|
|
||||||
// Mempool validated transactions
|
// Mempool validated transactions
|
||||||
txs := cs.mempool.Reap()
|
// if block_size < 0, no txs will be included
|
||||||
|
var txs []types.Tx
|
||||||
|
if maxBlockSize >= 0 {
|
||||||
|
txs = cs.mempool.Reap()
|
||||||
|
}
|
||||||
|
|
||||||
// Cap the number of txs in a block
|
// Cap the number of txs in a block
|
||||||
maxBlockSize := config.GetInt("block_size")
|
|
||||||
if maxBlockSize > 0 && maxBlockSize < len(txs) {
|
if maxBlockSize > 0 && maxBlockSize < len(txs) {
|
||||||
txs = txs[:maxBlockSize]
|
txs = txs[:maxBlockSize]
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,10 +184,6 @@ func (mem *Mempool) resCbRecheck(req *tmsp.Request, res *tmsp.Response) {
|
||||||
|
|
||||||
// Get the valid transactions remaining
|
// Get the valid transactions remaining
|
||||||
func (mem *Mempool) Reap() []types.Tx {
|
func (mem *Mempool) Reap() []types.Tx {
|
||||||
if !config.GetBool("mempool_reap") {
|
|
||||||
return []types.Tx{}
|
|
||||||
}
|
|
||||||
|
|
||||||
mem.proxyMtx.Lock()
|
mem.proxyMtx.Lock()
|
||||||
defer mem.proxyMtx.Unlock()
|
defer mem.proxyMtx.Unlock()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue