Merge branch 'extip-in-enr' into devel
This commit is contained in:
commit
9922267ca2
|
@ -16,7 +16,7 @@ export
|
||||||
|
|
||||||
proc new*(T: type Eth2DiscoveryProtocol,
|
proc new*(T: type Eth2DiscoveryProtocol,
|
||||||
conf: BeaconNodeConf,
|
conf: BeaconNodeConf,
|
||||||
rawPrivKeyBytes: openarray[byte]): T =
|
ip: IpAddress, rawPrivKeyBytes: openarray[byte]): T =
|
||||||
# TODO
|
# TODO
|
||||||
# Implement more configuration options:
|
# Implement more configuration options:
|
||||||
# * for setting up a specific key
|
# * for setting up a specific key
|
||||||
|
@ -25,7 +25,7 @@ proc new*(T: type Eth2DiscoveryProtocol,
|
||||||
pk = initPrivateKey(rawPrivKeyBytes)
|
pk = initPrivateKey(rawPrivKeyBytes)
|
||||||
db = DiscoveryDB.init(newMemoryDB())
|
db = DiscoveryDB.init(newMemoryDB())
|
||||||
|
|
||||||
newProtocol(pk, db, Port conf.tcpPort, Port conf.udpPort)
|
newProtocol(pk, db, ip, Port conf.tcpPort, Port conf.udpPort)
|
||||||
|
|
||||||
proc toENode*(a: MultiAddress): Result[ENode, cstring] =
|
proc toENode*(a: MultiAddress): Result[ENode, cstring] =
|
||||||
if not IPFS.match(a):
|
if not IPFS.match(a):
|
||||||
|
|
|
@ -156,7 +156,7 @@ when networkBackend in [libp2p, libp2pDaemon]:
|
||||||
# are running behind a NAT).
|
# are running behind a NAT).
|
||||||
var switch = newStandardSwitch(some keys.seckey, hostAddress,
|
var switch = newStandardSwitch(some keys.seckey, hostAddress,
|
||||||
triggerSelf = true, gossip = false)
|
triggerSelf = true, gossip = false)
|
||||||
result = Eth2Node.init(conf, switch, keys.seckey.asEthKey)
|
result = Eth2Node.init(conf, switch, extIp, keys.seckey.asEthKey)
|
||||||
else:
|
else:
|
||||||
let keyFile = conf.ensureNetworkIdFile
|
let keyFile = conf.ensureNetworkIdFile
|
||||||
|
|
||||||
|
|
|
@ -220,11 +220,11 @@ proc runDiscoveryLoop*(node: Eth2Node) {.async.} =
|
||||||
await sleepAsync seconds(1)
|
await sleepAsync seconds(1)
|
||||||
|
|
||||||
proc init*(T: type Eth2Node, conf: BeaconNodeConf,
|
proc init*(T: type Eth2Node, conf: BeaconNodeConf,
|
||||||
switch: Switch, privKey: keys.PrivateKey): T =
|
switch: Switch, ip: IpAddress, privKey: keys.PrivateKey): T =
|
||||||
new result
|
new result
|
||||||
result.switch = switch
|
result.switch = switch
|
||||||
result.peers = initTable[PeerID, Peer]()
|
result.peers = initTable[PeerID, Peer]()
|
||||||
result.discovery = Eth2DiscoveryProtocol.new(conf, privKey.data)
|
result.discovery = Eth2DiscoveryProtocol.new(conf, ip, privKey.data)
|
||||||
result.wantedPeers = conf.maxPeers
|
result.wantedPeers = conf.maxPeers
|
||||||
|
|
||||||
newSeq result.protocolStates, allProtocols.len
|
newSeq result.protocolStates, allProtocols.len
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f1acc470eb01a4d9086e752d103a73e49a372eaf
|
Subproject commit b9315ced4e2d7926737dab73b2374543088e17fd
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5aebab3f41834505af7c694f8caf2e8c9c5716cc
|
Subproject commit 74d0247e6b69bf45d4e53c27e0089d5bb35b29ed
|
|
@ -1 +1 @@
|
||||||
Subproject commit e7a34b74f298eaabd7bdbe2f080bf9747ed6bfd9
|
Subproject commit 5fb40e4ffd2c5a7eca88203d99150e2d99732e41
|
Loading…
Reference in New Issue