File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -61,15 +61,6 @@ func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
6161 return api .Etherbase ()
6262}
6363
64- // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
65- func (api * PublicEthereumAPI ) ChainId () (hexutil.Uint64 , error ) {
66- // if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
67- if config := api .e .blockchain .Config (); config .IsEIP155 (api .e .blockchain .CurrentBlock ().Number ()) {
68- return (hexutil .Uint64 )(config .ChainID .Uint64 ()), nil
69- }
70- return hexutil .Uint64 (0 ), fmt .Errorf ("chain not synced beyond EIP-155 replay-protection fork block" )
71- }
72-
7364// PublicMinerAPI provides an API to control the miner.
7465// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
7566type PublicMinerAPI struct {
Original file line number Diff line number Diff line change @@ -529,9 +529,13 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
529529 return & PublicBlockChainAPI {b }
530530}
531531
532- // ChainId returns the chainID value for transaction replay protection.
533- func (s * PublicBlockChainAPI ) ChainId () * hexutil.Big {
534- return (* hexutil .Big )(s .b .ChainConfig ().ChainID )
532+ // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
533+ func (api * PublicBlockChainAPI ) ChainId () (* hexutil.Big , error ) {
534+ // if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
535+ if config := api .b .ChainConfig (); config .IsEIP155 (api .b .CurrentBlock ().Number ()) {
536+ return (* hexutil .Big )(config .ChainID ), nil
537+ }
538+ return nil , fmt .Errorf ("chain not synced beyond EIP-155 replay-protection fork block" )
535539}
536540
537541// BlockNumber returns the block number of the chain head.
You can’t perform that action at this time.
0 commit comments