check gas fee cap for minimum value

This commit is contained in:
vyzo 2020-08-26 21:23:28 +03:00
parent 793eda986b
commit 8db262c941

View File

@ -48,6 +48,8 @@ const RbfDenom = 256
var RepublishInterval = pubsub.TimeCacheDuration + time.Duration(5*build.BlockDelaySecs+build.PropagationDelaySecs)*time.Second var RepublishInterval = pubsub.TimeCacheDuration + time.Duration(5*build.BlockDelaySecs+build.PropagationDelaySecs)*time.Second
var minimumBaseFee = types.NewInt(build.MinimumBaseFee)
var ( var (
ErrMessageTooBig = errors.New("message too big") ErrMessageTooBig = errors.New("message too big")
@ -55,6 +57,8 @@ var (
ErrNonceTooLow = errors.New("message nonce too low") ErrNonceTooLow = errors.New("message nonce too low")
ErrGasFeeCapTooLow = errors.New("gas fee cap too low")
ErrNotEnoughFunds = errors.New("not enough funds to execute transaction") ErrNotEnoughFunds = errors.New("not enough funds to execute transaction")
ErrInvalidToAddr = errors.New("message had invalid to address") ErrInvalidToAddr = errors.New("message had invalid to address")
@ -349,6 +353,10 @@ func (mp *MessagePool) checkMessage(m *types.SignedMessage) error {
return ErrMessageValueTooHigh return ErrMessageValueTooHigh
} }
if m.Message.GasFeeCap.LessThan(minimumBaseFee) {
return ErrGasFeeCapTooLow
}
if err := mp.VerifyMsgSig(m); err != nil { if err := mp.VerifyMsgSig(m); err != nil {
log.Warnf("signature verification failed: %s", err) log.Warnf("signature verification failed: %s", err)
return err return err