Merge pull request #1617 from mikedoan/chainID

[transactionpool.go] check chainID for incoming tx
pull/1618/head
Leo Chen 5 years ago committed by GitHub
commit af8f5a8d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      internal/hmyapi/error.go
  2. 3
      internal/hmyapi/transactionpool.go

@ -0,0 +1,8 @@
package hmyapi
import "errors"
var (
// ErrIncorrectChainID is an incorrect chain ID.
ErrIncorrectChainID = errors.New("Incorrect chain ID")
)

@ -131,6 +131,9 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod
if err := rlp.DecodeBytes(encodedTx, tx); err != nil {
return common.Hash{}, err
}
if tx.ChainID() != s.b.ChainConfig().ChainID {
return common.Hash{}, ErrIncorrectChainID
}
return SubmitTransaction(ctx, s.b, tx)
}

Loading…
Cancel
Save