Skip to content

Commit

Permalink
internal/ethapi: always return chain id (ethereum#25166)
Browse files Browse the repository at this point in the history
The error was introduced in PR ethereum#21686, but there is no good reason to enforce sync
in this method, and it causes issues with EL/CL integration.
  • Loading branch information
lightclient authored and jagdeep sidhu committed Jul 4, 2022
1 parent 4c376f3 commit 5589a5b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/ethapi/api.go
Expand Up @@ -609,12 +609,8 @@ func NewBlockChainAPI(b Backend) *BlockChainAPI {
}

// ChainId is the EIP-155 replay-protection chain id for the current Ethereum chain config.
func (api *BlockChainAPI) ChainId() (*hexutil.Big, error) {
// if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
if config := api.b.ChainConfig(); config.IsEIP155(api.b.CurrentBlock().Number()) {
return (*hexutil.Big)(config.ChainID), nil
}
return nil, fmt.Errorf("chain not synced beyond EIP-155 replay-protection fork block")
func (api *BlockChainAPI) ChainId() *hexutil.Big {
return (*hexutil.Big)(api.b.ChainConfig().ChainID)
}

// BlockNumber returns the block number of the chain head.
Expand Down

0 comments on commit 5589a5b

Please sign in to comment.