mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-03 08:31:20 +00:00
maxTxs=-1 for Reap to return empty
This commit is contained in:
parent
f5be3cd8f9
commit
196af01707
@ -201,10 +201,12 @@ func (mem *Mempool) Reap(maxTxs int) []types.Tx {
|
|||||||
return txs
|
return txs
|
||||||
}
|
}
|
||||||
|
|
||||||
// maxTxs: 0 means uncapped
|
// maxTxs: 0 means uncapped, -1 means none
|
||||||
func (mem *Mempool) collectTxs(maxTxs int) []types.Tx {
|
func (mem *Mempool) collectTxs(maxTxs int) []types.Tx {
|
||||||
if maxTxs == 0 {
|
if maxTxs == 0 {
|
||||||
maxTxs = mem.txs.Len()
|
maxTxs = mem.txs.Len()
|
||||||
|
} else if maxTxs < 0 {
|
||||||
|
return []types.Tx{}
|
||||||
}
|
}
|
||||||
txs := make([]types.Tx, 0, MinInt(mem.txs.Len(), maxTxs))
|
txs := make([]types.Tx, 0, MinInt(mem.txs.Len(), maxTxs))
|
||||||
for e := mem.txs.Front(); e != nil && len(txs) < maxTxs; e = e.Next() {
|
for e := mem.txs.Front(); e != nil && len(txs) < maxTxs; e = e.Next() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user