Skip to content

Commit

Permalink
chore: revise to remove redundant isFull()
Browse files Browse the repository at this point in the history
  • Loading branch information
jinsan-line committed Jan 5, 2021
1 parent 1b23f66 commit 55990ec
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ func (mem *CListMempool) CheckTx(tx types.Tx, cb func(*abci.Response), txInfo Tx

txSize := len(tx)

if err := mem.isFull(txSize); err != nil {
return err
}

// The size of the corresponding amino-encoded TxMessage
// can't be larger than the maxMsgSize, otherwise we can't
// relay it to peers.
Expand Down Expand Up @@ -367,22 +363,6 @@ func (mem *CListMempool) removeTx(tx types.Tx, elem *clist.CElement, removeFromC
}
}

func (mem *CListMempool) isFull(txSize int) error {
var (
memSize = mem.Size()
txsBytes = mem.TxsBytes()
)

if memSize >= mem.config.Size || int64(txSize)+txsBytes > mem.config.MaxTxsBytes {
return ErrMempoolIsFull{
memSize, mem.config.Size,
txsBytes, mem.config.MaxTxsBytes,
}
}

return nil
}

func (mem *CListMempool) reserve(txSize int64) error {
mem.reservedMtx.Lock()
defer mem.reservedMtx.Unlock()
Expand Down

0 comments on commit 55990ec

Please sign in to comment.