fix support for eth testnet chains (use correct tx signer)

This commit is contained in:
Ian Norden
2020-08-12 09:26:18 -05:00
parent c4876739a1
commit 52b5c99760
10 changed files with 55 additions and 16 deletions
+21 -1
View File
@@ -16,7 +16,11 @@
package eth
import "github.com/ethereum/go-ethereum/statediff"
import (
"fmt"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/statediff"
)
func ResolveFromNodeType(nodeType statediff.NodeType) int {
switch nodeType {
@@ -47,3 +51,19 @@ func ResolveToNodeType(nodeType int) statediff.NodeType {
return statediff.Unknown
}
}
// ChainConfig returns the appropriate ethereum chain config for the provided chain id
func ChainConfig(chainID uint64) (*params.ChainConfig, error) {
switch chainID {
case 1:
return params.MainnetChainConfig, nil
case 3:
return params.TestnetChainConfig, nil // Ropsten
case 4:
return params.RinkebyChainConfig, nil
case 5:
return params.GoerliChainConfig, nil
default:
return nil, fmt.Errorf("chain config for chainid %d not available", chainID)
}
}