mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-19 17:58:23 +00:00
Local sim finalizes with native LibP2P
This commit is contained in:
parent
6ae4070d3f
commit
10e6d4842f
@ -222,7 +222,8 @@ else:
|
|||||||
# TODO nim-libp2p still doesn't have support for announcing addresses
|
# TODO nim-libp2p still doesn't have support for announcing addresses
|
||||||
# that are different from the host address (this is relevant when we
|
# that are different from the host address (this is relevant when we
|
||||||
# are running behind a NAT).
|
# are running behind a NAT).
|
||||||
result = Eth2Node.init newStandardSwitch(some keys.seckey, hostAddress)
|
result = Eth2Node.init newStandardSwitch(some keys.seckey, hostAddress,
|
||||||
|
triggerSelf = true, gossip = true)
|
||||||
await result.start()
|
await result.start()
|
||||||
else:
|
else:
|
||||||
let keyFile = conf.ensureNetworkIdFile
|
let keyFile = conf.ensureNetworkIdFile
|
||||||
|
@ -7,6 +7,8 @@ import
|
|||||||
when networkBackend == rlpx:
|
when networkBackend == rlpx:
|
||||||
import eth/rlp/options as rlpOptions
|
import eth/rlp/options as rlpOptions
|
||||||
template libp2pProtocol*(name: string, version: int) {.pragma.}
|
template libp2pProtocol*(name: string, version: int) {.pragma.}
|
||||||
|
elif networkBackend == libp2p:
|
||||||
|
import libp2p/switch
|
||||||
|
|
||||||
declarePublicGauge libp2p_peers, "Number of libp2p peers"
|
declarePublicGauge libp2p_peers, "Number of libp2p peers"
|
||||||
|
|
||||||
@ -162,6 +164,14 @@ proc handleInitialStatus(peer: Peer,
|
|||||||
state: BeaconSyncNetworkState,
|
state: BeaconSyncNetworkState,
|
||||||
ourStatus: StatusMsg,
|
ourStatus: StatusMsg,
|
||||||
theirStatus: StatusMsg) {.async, gcsafe.} =
|
theirStatus: StatusMsg) {.async, gcsafe.} =
|
||||||
|
when networkBackend == libp2p:
|
||||||
|
# TODO: This doesn't seem like an appropraite place for this call,
|
||||||
|
# but it's hard to pick a better place at the moment.
|
||||||
|
# nim-libp2p plans to add a general `onPeerConnected` callback which
|
||||||
|
# will allow us to implement the subscription earlier.
|
||||||
|
# The root of the problem is that both sides must call `subscribeToPeer`
|
||||||
|
# before any GossipSub traffic will flow between them.
|
||||||
|
await peer.network.switch.subscribeToPeer(peer.info)
|
||||||
|
|
||||||
if theirStatus.forkVersion != state.forkVersion:
|
if theirStatus.forkVersion != state.forkVersion:
|
||||||
notice "Irrelevant peer",
|
notice "Irrelevant peer",
|
||||||
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 3f721e7ef66bb6e6004cd49202fcf23b29d2ff9d
|
Subproject commit 5bd7baaf9c1a0232822f467af85ed3a18fa6c033
|
2
vendor/nim-libp2p
vendored
2
vendor/nim-libp2p
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 454f658ba8aae8050bc0ffd800f1014cd68dbcb2
|
Subproject commit 77e866d29a58ad6cfefaf9c8a8ee7159a43bcfe5
|
Loading…
x
Reference in New Issue
Block a user