aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-25 19:31:15 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-04-25 19:53:50 +0800
commite61035c5a3630e4f6fd0fb3e5346a4eed8cedc80 (patch)
tree9dd32e8fb794b4950313ae2b2cd5499bb60dc4cd /les
parentba3bcd16a6d99bc0e58516556df8e96b730c2d60 (diff)
downloaddexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar.gz
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar.bz2
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar.lz
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar.xz
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.tar.zst
dexon-e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80.zip
cmd, eth, les, mobile: make networkid uint64 everywhere
Diffstat (limited to 'les')
-rw-r--r--les/backend.go6
-rw-r--r--les/handler.go6
-rw-r--r--les/peer.go8
3 files changed, 10 insertions, 10 deletions
diff --git a/les/backend.go b/les/backend.go
index 783e6e94e..646c81a7b 100644
--- a/les/backend.go
+++ b/les/backend.go
@@ -61,7 +61,7 @@ type LightEthereum struct {
engine consensus.Engine
accountManager *accounts.Manager
- netVersionId int
+ networkId uint64
netRPCService *ethapi.PublicNetAPI
}
@@ -87,7 +87,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
accountManager: ctx.AccountManager,
engine: eth.CreateConsensusEngine(ctx, config, chainConfig, chainDb),
shutdownChan: make(chan bool),
- netVersionId: config.NetworkId,
+ networkId: config.NetworkId,
}
if eth.blockchain, err = light.NewLightChain(odr, eth.chainConfig, eth.engine, eth.eventMux); err != nil {
return nil, err
@@ -187,7 +187,7 @@ func (s *LightEthereum) Protocols() []p2p.Protocol {
// Ethereum protocol implementation.
func (s *LightEthereum) Start(srvr *p2p.Server) error {
log.Warn("Light client mode is an experimental feature")
- s.netRPCService = ethapi.NewPublicNetAPI(srvr, s.netVersionId)
+ s.netRPCService = ethapi.NewPublicNetAPI(srvr, s.networkId)
s.protocolManager.Start(srvr)
return nil
}
diff --git a/les/handler.go b/les/handler.go
index fbb9e9906..64023af0f 100644
--- a/les/handler.go
+++ b/les/handler.go
@@ -95,7 +95,7 @@ type ProtocolManager struct {
lightSync bool
txpool txPool
txrelay *LesTxRelay
- networkId int
+ networkId uint64
chainConfig *params.ChainConfig
blockchain BlockChain
chainDb ethdb.Database
@@ -128,7 +128,7 @@ type ProtocolManager struct {
// NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable
// with the ethereum network.
-func NewProtocolManager(chainConfig *params.ChainConfig, lightSync bool, networkId int, mux *event.TypeMux, engine consensus.Engine, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, txrelay *LesTxRelay) (*ProtocolManager, error) {
+func NewProtocolManager(chainConfig *params.ChainConfig, lightSync bool, networkId uint64, mux *event.TypeMux, engine consensus.Engine, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, txrelay *LesTxRelay) (*ProtocolManager, error) {
// Create the protocol manager with the base fields
manager := &ProtocolManager{
lightSync: lightSync,
@@ -310,7 +310,7 @@ func (pm *ProtocolManager) Stop() {
log.Info("Light Ethereum protocol stopped")
}
-func (pm *ProtocolManager) newPeer(pv, nv int, p *p2p.Peer, rw p2p.MsgReadWriter) *peer {
+func (pm *ProtocolManager) newPeer(pv int, nv uint64, p *p2p.Peer, rw p2p.MsgReadWriter) *peer {
return newPeer(pv, nv, p, newMeteredMsgWriter(rw))
}
diff --git a/les/peer.go b/les/peer.go
index f45605593..ab55bafe3 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -48,8 +48,8 @@ type peer struct {
rw p2p.MsgReadWriter
- version int // Protocol version negotiated
- network int // Network ID being on
+ version int // Protocol version negotiated
+ network uint64 // Network ID being on
id string
@@ -69,7 +69,7 @@ type peer struct {
fcCosts requestCostTable
}
-func newPeer(version, network int, p *p2p.Peer, rw p2p.MsgReadWriter) *peer {
+func newPeer(version int, network uint64, p *p2p.Peer, rw p2p.MsgReadWriter) *peer {
id := p.ID()
return &peer{
@@ -384,7 +384,7 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis
if rGenesis != genesis {
return errResp(ErrGenesisBlockMismatch, "%x (!= %x)", rGenesis[:8], genesis[:8])
}
- if int(rNetwork) != p.network {
+ if rNetwork != p.network {
return errResp(ErrNetworkIdMismatch, "%d (!= %d)", rNetwork, p.network)
}
if int(rVersion) != p.version {