github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/bft/mempool/errors.go (about)

     1  package mempool
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/gnolang/gno/tm2/pkg/errors"
     7  )
     8  
     9  // ErrTxInCache is returned to the client if we saw tx earlier
    10  var ErrTxInCache = errors.New("Tx already exists in cache")
    11  
    12  // TxTooLargeError means the tx is too big to be sent in a message to other peers
    13  type TxTooLargeError struct {
    14  	max    int64
    15  	actual int64
    16  }
    17  
    18  func (e TxTooLargeError) Error() string {
    19  	return fmt.Sprintf("Tx too large. Max size is %d, but got %d", e.max, e.actual)
    20  }
    21  
    22  // MempoolIsFullError means Tendermint & an application can't handle that much load
    23  type MempoolIsFullError struct {
    24  	numTxs int
    25  	maxTxs int
    26  
    27  	txsBytes    int64
    28  	maxTxsBytes int64
    29  }
    30  
    31  func (e MempoolIsFullError) Error() string {
    32  	return fmt.Sprintf(
    33  		"mempool is full: number of txs %d (max: %d), total txs bytes %d (max: %d)",
    34  		e.numTxs, e.maxTxs,
    35  		e.txsBytes, e.maxTxsBytes)
    36  }