|
|
@ -24,12 +24,13 @@ import ( |
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/core" |
|
|
|
"github.com/ethereum/go-ethereum/core" |
|
|
|
"github.com/ethereum/go-ethereum/core/state" |
|
|
|
"github.com/ethereum/go-ethereum/core/state" |
|
|
|
"github.com/ethereum/go-ethereum/eth" |
|
|
|
"github.com/ethereum/go-ethereum/eth" |
|
|
|
"github.com/ethereum/go-ethereum/ethclient" |
|
|
|
"github.com/ethereum/go-ethereum/ethclient" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/les" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/light" |
|
|
|
"github.com/ethereum/go-ethereum/node" |
|
|
|
"github.com/ethereum/go-ethereum/node" |
|
|
|
"github.com/ethereum/go-ethereum/p2p/nat" |
|
|
|
"github.com/ethereum/go-ethereum/p2p/nat" |
|
|
|
"github.com/ethereum/go-ethereum/whisper/whisperv2" |
|
|
|
"github.com/ethereum/go-ethereum/whisper/whisperv2" |
|
|
@ -107,9 +108,11 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
// Create the empty networking stack
|
|
|
|
// Create the empty networking stack
|
|
|
|
nodeConf := &node.Config{ |
|
|
|
nodeConf := &node.Config{ |
|
|
|
|
|
|
|
Name: clientIdentifier, |
|
|
|
DataDir: datadir, |
|
|
|
DataDir: datadir, |
|
|
|
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
|
|
|
|
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
|
|
|
|
Name: common.MakeName(clientIdentifier, utils.Version), |
|
|
|
NoDiscovery: true, |
|
|
|
|
|
|
|
DiscoveryV5: true, |
|
|
|
BootstrapNodes: config.BootstrapNodes.nodes, |
|
|
|
BootstrapNodes: config.BootstrapNodes.nodes, |
|
|
|
ListenAddr: ":0", |
|
|
|
ListenAddr: ":0", |
|
|
|
NAT: nat.Any(), |
|
|
|
NAT: nat.Any(), |
|
|
@ -123,12 +126,14 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) { |
|
|
|
if config.EthereumEnabled { |
|
|
|
if config.EthereumEnabled { |
|
|
|
ethConf := ð.Config{ |
|
|
|
ethConf := ð.Config{ |
|
|
|
ChainConfig: &core.ChainConfig{ |
|
|
|
ChainConfig: &core.ChainConfig{ |
|
|
|
HomesteadBlock: big.NewInt(config.EthereumChainConfig.HomesteadBlock), |
|
|
|
HomesteadBlock: big.NewInt(config.EthereumChainConfig.HomesteadBlock), |
|
|
|
DAOForkBlock: big.NewInt(config.EthereumChainConfig.DAOForkBlock), |
|
|
|
DAOForkBlock: big.NewInt(config.EthereumChainConfig.DAOForkBlock), |
|
|
|
DAOForkSupport: config.EthereumChainConfig.DAOForkSupport, |
|
|
|
DAOForkSupport: config.EthereumChainConfig.DAOForkSupport, |
|
|
|
|
|
|
|
HomesteadGasRepriceBlock: big.NewInt(config.EthereumChainConfig.HomesteadGasRepriceBlock), |
|
|
|
|
|
|
|
HomesteadGasRepriceHash: config.EthereumChainConfig.HomesteadGasRepriceHash.hash, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Genesis: config.EthereumGenesis, |
|
|
|
Genesis: config.EthereumGenesis, |
|
|
|
FastSync: true, |
|
|
|
LightMode: true, |
|
|
|
DatabaseCache: config.EthereumDatabaseCache, |
|
|
|
DatabaseCache: config.EthereumDatabaseCache, |
|
|
|
NetworkId: config.EthereumNetworkID, |
|
|
|
NetworkId: config.EthereumNetworkID, |
|
|
|
GasPrice: new(big.Int).Mul(big.NewInt(20), common.Shannon), |
|
|
|
GasPrice: new(big.Int).Mul(big.NewInt(20), common.Shannon), |
|
|
@ -141,9 +146,10 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
if config.EthereumTestnetNonces { |
|
|
|
if config.EthereumTestnetNonces { |
|
|
|
state.StartingNonce = 1048576 // (2**20)
|
|
|
|
state.StartingNonce = 1048576 // (2**20)
|
|
|
|
|
|
|
|
light.StartingNonce = 1048576 // (2**20)
|
|
|
|
} |
|
|
|
} |
|
|
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { |
|
|
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { |
|
|
|
return eth.New(ctx, ethConf) |
|
|
|
return les.New(ctx, ethConf) |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
return nil, fmt.Errorf("ethereum init: %v", err) |
|
|
|
return nil, fmt.Errorf("ethereum init: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|