@@ -59,6 +59,13 @@ open class Config(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
configFilePath = getConfigPath()
|
configFilePath = getConfigPath()
|
||||||
|
Global.version = env.getProperty("version.app", Global.version).let {
|
||||||
|
if (it.contains("SNAPSHOT")) {
|
||||||
|
listOfNotNull(it, env.getProperty("version.commit")).joinToString("-")
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getConfigPath(): File {
|
fun getConfigPath(): File {
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ class Global {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val objectMapper: ObjectMapper = createObjectMapper()
|
val objectMapper: ObjectMapper = createObjectMapper()
|
||||||
|
|
||||||
|
var version: String = "DEV"
|
||||||
|
|
||||||
val control: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor()
|
val control: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor()
|
||||||
|
|
||||||
private fun createObjectMapper(): ObjectMapper {
|
private fun createObjectMapper(): ObjectMapper {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.emeraldpay.dshackle.upstream.calls
|
package io.emeraldpay.dshackle.upstream.calls
|
||||||
|
|
||||||
|
import io.emeraldpay.dshackle.Global
|
||||||
import io.emeraldpay.dshackle.quorum.AlwaysQuorum
|
import io.emeraldpay.dshackle.quorum.AlwaysQuorum
|
||||||
import io.emeraldpay.dshackle.quorum.BroadcastQuorum
|
import io.emeraldpay.dshackle.quorum.BroadcastQuorum
|
||||||
import io.emeraldpay.dshackle.quorum.CallQuorum
|
import io.emeraldpay.dshackle.quorum.CallQuorum
|
||||||
@@ -25,6 +26,11 @@ import java.util.Collections
|
|||||||
|
|
||||||
class DefaultBitcoinMethods : CallMethods {
|
class DefaultBitcoinMethods : CallMethods {
|
||||||
|
|
||||||
|
private val networkinfo = Global.objectMapper.writeValueAsBytes(mapOf(
|
||||||
|
"version" to 210100,
|
||||||
|
"subversion" to "/EmeraldDshackle:${Global.version}/"
|
||||||
|
))
|
||||||
|
|
||||||
private val freshMethods = listOf(
|
private val freshMethods = listOf(
|
||||||
"getblock",
|
"getblock",
|
||||||
"gettransaction", "gettxout",
|
"gettransaction", "gettxout",
|
||||||
@@ -77,7 +83,7 @@ class DefaultBitcoinMethods : CallMethods {
|
|||||||
override fun executeHardcoded(method: String): ByteArray {
|
override fun executeHardcoded(method: String): ByteArray {
|
||||||
return when (method) {
|
return when (method) {
|
||||||
"getconnectioncount" -> "42".toByteArray()
|
"getconnectioncount" -> "42".toByteArray()
|
||||||
"getnetworkinfo" -> "{\"version\": 700000, \"subversion\": \"/EmeraldDshackle:v0.9/\"}".toByteArray()
|
"getnetworkinfo" -> networkinfo
|
||||||
else -> throw RpcException(-32601, "Method not found")
|
else -> throw RpcException(-32601, "Method not found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.emeraldpay.dshackle.upstream.calls
|
package io.emeraldpay.dshackle.upstream.calls
|
||||||
|
|
||||||
|
import io.emeraldpay.dshackle.Global
|
||||||
import io.emeraldpay.dshackle.quorum.AlwaysQuorum
|
import io.emeraldpay.dshackle.quorum.AlwaysQuorum
|
||||||
import io.emeraldpay.dshackle.quorum.BroadcastQuorum
|
import io.emeraldpay.dshackle.quorum.BroadcastQuorum
|
||||||
import io.emeraldpay.dshackle.quorum.CallQuorum
|
import io.emeraldpay.dshackle.quorum.CallQuorum
|
||||||
@@ -32,6 +33,8 @@ class DefaultEthereumMethods(
|
|||||||
private val chain: Chain
|
private val chain: Chain
|
||||||
) : CallMethods {
|
) : CallMethods {
|
||||||
|
|
||||||
|
private val version = "\"EmeraldDshackle/${Global.version}\""
|
||||||
|
|
||||||
private val anyResponseMethods = listOf(
|
private val anyResponseMethods = listOf(
|
||||||
"eth_gasPrice",
|
"eth_gasPrice",
|
||||||
"eth_call",
|
"eth_call",
|
||||||
@@ -178,7 +181,7 @@ class DefaultEthereumMethods(
|
|||||||
"true"
|
"true"
|
||||||
}
|
}
|
||||||
"web3_clientVersion" -> {
|
"web3_clientVersion" -> {
|
||||||
"\"EmeraldDshackle/v0.9\""
|
version
|
||||||
}
|
}
|
||||||
"eth_protocolVersion" -> {
|
"eth_protocolVersion" -> {
|
||||||
"\"0x3f\""
|
"\"0x3f\""
|
||||||
|
|||||||
Reference in New Issue
Block a user