github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/mempool/errors.go (about) 1 package mempool 2 3 import ( 4 "fmt" 5 6 "github.com/pkg/errors" 7 ) 8 9 var ( 10 // ErrTxInCache is returned to the client if we saw tx earlier 11 ErrTxInCache = errors.New("tx already exists in cache") 12 ) 13 14 // ErrTxTooLarge means the tx is too big to be sent in a message to other peers 15 type ErrTxTooLarge struct { 16 max int 17 actual int 18 } 19 20 func (e ErrTxTooLarge) Error() string { 21 return fmt.Sprintf("Tx too large. Max size is %d, but got %d", e.max, e.actual) 22 } 23 24 // ErrMempoolIsFull means Tendermint & an application can't handle that much load 25 type ErrMempoolIsFull struct { 26 numTxs int 27 maxTxs int 28 29 txsBytes int64 30 maxTxsBytes int64 31 } 32 33 func (e ErrMempoolIsFull) Error() string { 34 return fmt.Sprintf( 35 "mempool is full: number of txs %d (max: %d), total txs bytes %d (max: %d)", 36 e.numTxs, e.maxTxs, 37 e.txsBytes, e.maxTxsBytes) 38 } 39 40 // ErrPreCheck is returned when tx is too big 41 type ErrPreCheck struct { 42 Reason error 43 } 44 45 func (e ErrPreCheck) Error() string { 46 return e.Reason.Error() 47 } 48 49 // IsPreCheckError returns true if err is due to pre check failure. 50 func IsPreCheckError(err error) bool { 51 _, ok := err.(ErrPreCheck) 52 return ok 53 }