Skip to content

Commit

Permalink
Add error message for unsupported gas price (ethereum#223)
Browse files Browse the repository at this point in the history
* Add error message for unsupported gas price

* Nit fix

* Add error to eth_sign and fix msg
  • Loading branch information
karlfloersch authored Feb 25, 2021
1 parent 24918aa commit fca968a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,10 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod
if err := rlp.DecodeBytes(encodedTx, tx); err != nil {
return common.Hash{}, err
}

if new(big.Int).Mod(tx.GasPrice(), big.NewInt(1000000)).Cmp(big.NewInt(0)) != 0 {
return common.Hash{}, errors.New("Gas price must be a multiple of 1,000,000 wei")
}
// L1Timestamp and L1BlockNumber will be set by the miner
meta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer)
tx.SetTransactionMeta(meta)
Expand All @@ -1679,6 +1683,10 @@ func (s *PublicTransactionPoolAPI) SendRawEthSignTransaction(ctx context.Context
if err := rlp.DecodeBytes(encodedTx, tx); err != nil {
return common.Hash{}, err
}

if new(big.Int).Mod(tx.GasPrice(), big.NewInt(1000000)).Cmp(big.NewInt(0)) != 0 {
return common.Hash{}, errors.New("Gas price must be a multiple of 1,000,000 wei")
}
// L1Timestamp and L1BlockNumber will be set by the miner
meta := types.NewTransactionMeta(nil, 0, nil, types.SighashEthSign, types.QueueOriginSequencer)
tx.SetTransactionMeta(meta)
Expand Down

0 comments on commit fca968a

Please sign in to comment.