Report connected peers before fork choice

This commit is contained in:
Mamy André-Ratsimbazafy 2019-03-22 12:33:10 +01:00
parent 894816fa0c
commit ca49ae9b5a
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1
3 changed files with 9 additions and 1 deletions

View File

@ -281,6 +281,9 @@ proc getAttachedValidator(node: BeaconNode, idx: int): AttachedValidator =
proc updateHead(node: BeaconNode): BlockRef =
# TODO move all of this logic to BlockPool
info "Preparing for fork choice",
connectedPeers = node.network.connectedPeers
let
justifiedHead = node.blockPool.latestJustifiedBlock()

View File

@ -435,6 +435,7 @@ proc updateHead*(pool: BlockPool, state: var StateData, blck: BlockRef) =
debug "No head update this time",
headBlockRoot = shortLog(blck.root),
headBlockSlot = humaneSlotNum(blck.slot)
return
pool.head = blck

View File

@ -8,7 +8,8 @@ const
when useRLPx:
import
os,
eth/[rlp, p2p, keys], gossipsub_protocol
eth/[rlp, p2p, keys], gossipsub_protocol,
eth/p2p/peer_pool # for log on connected peers
export
p2p, rlp, gossipsub_protocol
@ -74,6 +75,9 @@ when useRLPx:
proc init*(T: type BootstrapAddr, str: string): T =
initENode(str)
func connectedPeers*(enode: EthereumNode): int =
enode.peerPool.len
else:
import
libp2p/daemon/daemonapi, chronicles,