mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-09 12:31:21 +00:00
nit: tweak error handling for rlp too big (#834)
I believe ValidateSerializedTxn should be returning (or at least
wrapping) types.RlpTooBig instead of creating a new error when the
transaction exceeds max size, since this is the error the txpool
actually checks for:
61706714c3/txpool/txpool_grpc_server.go (L204)
Before this change the ImportResult for an oversized tx would be
INTERNAL_ERROR; after this change it will be INVALID, which seems more
appropriate.
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
This commit is contained in:
parent
fc3dd4fd27
commit
39694bc9d5
@ -822,7 +822,7 @@ func (p *TxPool) ValidateSerializedTxn(serializedTxn []byte) error {
|
||||
txMaxSize = 4 * txSlotSize // 128KB
|
||||
)
|
||||
if len(serializedTxn) > txMaxSize {
|
||||
return fmt.Errorf(RLPTooLong.String())
|
||||
return types.ErrRlpTooBig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func mapDiscardReasonToProto(reason DiscardReason) txpool_proto.ImportResult {
|
||||
return txpool_proto.ImportResult_ALREADY_EXISTS
|
||||
case UnderPriced, ReplaceUnderpriced, FeeTooLow:
|
||||
return txpool_proto.ImportResult_FEE_TOO_LOW
|
||||
case InvalidSender, NegativeValue, OversizedData, InitCodeTooLarge:
|
||||
case InvalidSender, NegativeValue, OversizedData, InitCodeTooLarge, RLPTooLong:
|
||||
return txpool_proto.ImportResult_INVALID
|
||||
default:
|
||||
return txpool_proto.ImportResult_INTERNAL_ERROR
|
||||
|
Loading…
Reference in New Issue
Block a user