problem: doesn't respond to eth_chainId method

fix: #22
This commit is contained in:
Igor Artamonov
2020-07-02 21:55:35 -04:00
parent 0d9ae3a936
commit a7fb805a03
3 changed files with 46 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ class AggregatedCallMethods(
override fun getQuorumFor(method: String): CallQuorum {
return delegates.find {
it.isAllowed(method) || it.isHardcoded(method)
}?.getQuorumFor(method) ?: throw IllegalStateException("No quorum for $method")
}?.getQuorumFor(method) ?: throw IllegalStateException("No executor delegate for $method")
}
/**

View File

@@ -76,7 +76,8 @@ class DefaultEthereumMethods(
"eth_coinbase",
"eth_mining",
"eth_hashrate",
"eth_accounts"
"eth_accounts",
"eth_chainId"
)
override fun getQuorumFor(method: String): CallQuorum {
@@ -125,6 +126,23 @@ class DefaultEthereumMethods(
else -> throw RpcException(-32602, "Invalid chain")
}
}
"eth_chainId" -> {
when {
Chain.ETHEREUM == chain -> {
"0x0"
}
Chain.ETHEREUM_CLASSIC == chain -> {
"0x3d"
}
Chain.TESTNET_MORDEN == chain -> {
"0x3c"
}
Chain.TESTNET_KOVAN == chain -> {
"0x2a"
}
else -> throw RpcException(-32602, "Invalid chain")
}
}
"net_peerCount" -> {
"\"0x2a\""
}