fix support for eth testnet chains (use correct tx signer)
This commit is contained in:
@@ -29,6 +29,7 @@ const (
|
||||
Ethereum
|
||||
Bitcoin
|
||||
Omni
|
||||
EthereumClassic
|
||||
)
|
||||
|
||||
func (c ChainType) String() string {
|
||||
@@ -39,6 +40,8 @@ func (c ChainType) String() string {
|
||||
return "Bitcoin"
|
||||
case Omni:
|
||||
return "Omni"
|
||||
case EthereumClassic:
|
||||
return "EthereumClassic"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
@@ -52,6 +55,8 @@ func (c ChainType) API() string {
|
||||
return "btc"
|
||||
case Omni:
|
||||
return "omni"
|
||||
case EthereumClassic:
|
||||
return "etc"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
@@ -65,6 +70,8 @@ func NewChainType(name string) (ChainType, error) {
|
||||
return Bitcoin, nil
|
||||
case "omni":
|
||||
return Omni, nil
|
||||
case "classic", "etc":
|
||||
return EthereumClassic, nil
|
||||
default:
|
||||
return UnknownChain, errors.New("invalid name for chain")
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ const (
|
||||
ETH_CLIENT_NAME = "ETH_CLIENT_NAME"
|
||||
ETH_GENESIS_BLOCK = "ETH_GENESIS_BLOCK"
|
||||
ETH_NETWORK_ID = "ETH_NETWORK_ID"
|
||||
ETH_CHAIN_ID = "ETH_CHAIN_ID"
|
||||
|
||||
BTC_WS_PATH = "BTC_WS_PATH"
|
||||
BTC_HTTP_PATH = "BTC_HTTP_PATH"
|
||||
@@ -48,6 +49,7 @@ const (
|
||||
BTC_CLIENT_NAME = "BTC_CLIENT_NAME"
|
||||
BTC_GENESIS_BLOCK = "BTC_GENESIS_BLOCK"
|
||||
BTC_NETWORK_ID = "BTC_NETWORK_ID"
|
||||
BTC_CHAIN_ID = "BTC_CHAIN_ID"
|
||||
)
|
||||
|
||||
// GetEthNodeAndClient returns eth node info and client from path url
|
||||
@@ -56,6 +58,7 @@ func GetEthNodeAndClient(path string) (node.Node, *rpc.Client, error) {
|
||||
viper.BindEnv("ethereum.clientName", ETH_CLIENT_NAME)
|
||||
viper.BindEnv("ethereum.genesisBlock", ETH_GENESIS_BLOCK)
|
||||
viper.BindEnv("ethereum.networkID", ETH_NETWORK_ID)
|
||||
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
||||
|
||||
rpcClient, err := rpc.Dial(path)
|
||||
if err != nil {
|
||||
@@ -66,6 +69,7 @@ func GetEthNodeAndClient(path string) (node.Node, *rpc.Client, error) {
|
||||
ClientName: viper.GetString("ethereum.clientName"),
|
||||
GenesisBlock: viper.GetString("ethereum.genesisBlock"),
|
||||
NetworkID: viper.GetString("ethereum.networkID"),
|
||||
ChainID: viper.GetUint64("ethereum.chainID"),
|
||||
}, rpcClient, nil
|
||||
}
|
||||
|
||||
@@ -101,6 +105,7 @@ func GetBtcNodeAndClient(path string) (node.Node, *rpcclient.ConnConfig) {
|
||||
viper.BindEnv("bitcoin.networkID", BTC_NETWORK_ID)
|
||||
viper.BindEnv("bitcoin.pass", BTC_NODE_PASSWORD)
|
||||
viper.BindEnv("bitcoin.user", BTC_NODE_USER)
|
||||
viper.BindEnv("bitcoin.chainID", BTC_CHAIN_ID)
|
||||
|
||||
// For bitcoin we load in node info from the config because there is no RPC endpoint to retrieve this from the node
|
||||
return node.Node{
|
||||
@@ -108,6 +113,7 @@ func GetBtcNodeAndClient(path string) (node.Node, *rpcclient.ConnConfig) {
|
||||
ClientName: viper.GetString("bitcoin.clientName"),
|
||||
GenesisBlock: viper.GetString("bitcoin.genesisBlock"),
|
||||
NetworkID: viper.GetString("bitcoin.networkID"),
|
||||
ChainID: viper.GetUint64("bitcoin.chainID"),
|
||||
}, &rpcclient.ConnConfig{
|
||||
Host: path,
|
||||
HTTPPostMode: true, // Bitcoin core only supports HTTP POST mode
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package shared
|
||||
|
||||
// Very loose interface types for generic processing of different blockchains
|
||||
// TODO: split different blockchain support into separate repos
|
||||
|
||||
// These types serve as very loose wrappers around a generic underlying interface{}
|
||||
type RawChainData interface{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user