diff options
author | Felix Lange <fjl@twurst.com> | 2019-06-11 19:12:33 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-06-11 19:12:33 +0800 |
commit | 2b546660187e8b693b6bbe5ec0fc74bfc008d1d3 (patch) | |
tree | 9a77a4b02a5ba0c43d37d1f7881489e7eb95d8d4 /internal | |
parent | c420dcb39c342842f6c115376774c79162465c64 (diff) | |
download | go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar.gz go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar.bz2 go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar.lz go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar.xz go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.tar.zst go-tangerine-2b546660187e8b693b6bbe5ec0fc74bfc008d1d3.zip |
ethclient, internal/ethapi: add support for EIP-695 (eth_chainId) (#19694)
EIP-695 was written in 2017. Parity and Infura have support for this
method and we should, too.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/ethapi/api.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 07142d66b..4132ff144 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -529,6 +529,11 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI { return &PublicBlockChainAPI{b} } +// ChainId returns the chainID value for transaction replay protection. +func (s *PublicBlockChainAPI) ChainId() *hexutil.Big { + return (*hexutil.Big)(s.b.ChainConfig().ChainID) +} + // BlockNumber returns the block number of the chain head. func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 { header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available |