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.
This commit is contained in:
committed by
Péter Szilágyi
parent
c420dcb39c
commit
2b54666018
@ -319,3 +319,19 @@ func TestTransactionInBlockInterrupted(t *testing.T) {
|
||||
t.Fatal("error should not be nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestChainID(t *testing.T) {
|
||||
backend, _ := newTestBackend(t)
|
||||
client, _ := backend.Attach()
|
||||
defer backend.Stop()
|
||||
defer client.Close()
|
||||
ec := NewClient(client)
|
||||
|
||||
id, err := ec.ChainID(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if id == nil || id.Cmp(params.AllEthashProtocolChanges.ChainID) != 0 {
|
||||
t.Fatalf("ChainID returned wrong number: %+v", id)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user