logging fixes

* don't log out-of-sync when there's no work to do
* small logging fixes
This commit is contained in:
Jacek Sieka 2019-12-10 10:55:37 +01:00 committed by Dustin Brody
parent 8ab0248209
commit eea523a89e
4 changed files with 8 additions and 4 deletions

View File

@ -257,7 +257,7 @@ proc getAttestationsForBlock*(
logScope: pcs = "retrieve_attestation"
if newBlockSlot < (GENESIS_SLOT + MIN_ATTESTATION_INCLUSION_DELAY):
debug "[Attestion Pool] Too early for attestations",
debug "Too early for attestations",
newBlockSlot = shortLog(newBlockSlot),
cat = "query"
return

View File

@ -760,7 +760,11 @@ proc onSlotStart(node: BeaconNode, lastSlot, scheduledSlot: Slot) {.gcsafe, asyn
# disappear naturally - risky because user is not aware,
# and might lose stake on canonical chain but "just works"
# when reconnected..
if not node.isSynced(head):
if node.attachedValidators.count == 0:
# There are no validators, thus we don't have any additional work to do
# beyond keeping track of the head
discard
elif not node.isSynced(head):
warn "Node out of sync, skipping block and attestation production for this slot",
slot, headSlot = head.slot
else:
@ -1198,4 +1202,3 @@ when isMainModule:
quit 1
echo navigator.navigatePath(pathFragments[1 .. ^1]).toJson

View File

@ -479,7 +479,7 @@ proc check_attestation*(
else:
if not (ffg_check_data == (state.previous_justified_checkpoint.epoch,
state.previous_justified_checkpoint.root, get_previous_epoch(state))):
warn("FFG data not matching current justified epoch")
warn("FFG data not matching previous justified epoch")
return
if not is_valid_indexed_attestation(

View File

@ -552,6 +552,7 @@ func shortLog*(v: BeaconBlock): auto =
func shortLog*(v: AttestationData): auto =
(
slot: shortLog(v.slot),
beacon_block_root: shortLog(v.beacon_block_root),
source_epoch: shortLog(v.source.epoch),
source_root: shortLog(v.source.root),