Tentative fix for self-connection discovery issues
This commit is contained in:
parent
71670ca9c9
commit
6d4284877d
|
@ -175,7 +175,14 @@ proc init*(T: type BeaconNode, conf: BeaconNodeConf): Future[BeaconNode] {.async
|
|||
result.network.saveConnectionAddressFile(addressFile)
|
||||
|
||||
proc connectToNetwork(node: BeaconNode) {.async.} =
|
||||
var bootstrapNodes = node.networkMetadata.bootstrapNodes
|
||||
let localKeys = ensureNetworkKeys(node.config)
|
||||
var bootstrapNodes = newSeq[BootstrapAddr]()
|
||||
|
||||
for bootNode in node.networkMetadata.bootstrapNodes:
|
||||
if bootNode.pubkey == localKeys.pubKey:
|
||||
node.isBootstrapNode = true
|
||||
else:
|
||||
bootstrapNodes.add bootNode
|
||||
|
||||
for bootNode in node.config.bootstrapNodes:
|
||||
bootstrapNodes.add BootstrapAddr.init(bootNode)
|
||||
|
|
|
@ -26,6 +26,7 @@ type
|
|||
BeaconNode* = ref object
|
||||
network*: EthereumNode
|
||||
networkMetadata*: NetworkMetadata
|
||||
isBootstrapNode*: bool
|
||||
db*: BeaconChainDB
|
||||
config*: BeaconNodeConf
|
||||
keys*: KeyPair
|
||||
|
|
|
@ -30,7 +30,7 @@ when useRLPx:
|
|||
else:
|
||||
parseIpAddress("127.0.0.1")
|
||||
|
||||
proc ensureNetworkKeys(conf: BeaconNodeConf): KeyPair =
|
||||
proc ensureNetworkKeys*(conf: BeaconNodeConf): KeyPair =
|
||||
let privateKeyFile = conf.dataDir / "network.privkey"
|
||||
var privKey: PrivateKey
|
||||
if not fileExists(privateKeyFile):
|
||||
|
|
Loading…
Reference in New Issue