diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index bbeb1e25f..9a42b633d 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -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() diff --git a/beacon_chain/block_pool.nim b/beacon_chain/block_pool.nim index e9d184e48..4f5ed9832 100644 --- a/beacon_chain/block_pool.nim +++ b/beacon_chain/block_pool.nim @@ -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 diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index 40e764c6f..65e7d0c5e 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -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,