@@ -107,12 +107,14 @@ func (t *Testnet) WaitForFinality(ctx context.Context) (common.Checkpoint, error
107107 }
108108
109109 var checkpoints eth2api.FinalityCheckpoints
110- if exists , err := beaconapi .FinalityCheckpoints (ctx , b .API , eth2api .StateIdRoot (headInfo .Header .Message .StateRoot ), & checkpoints ); err != nil {
111- ch <- res {err : fmt .Errorf ("beacon %d: failed to poll finality checkpoint: %v" , i , err )}
112- return
113- } else if ! exists {
114- ch <- res {err : fmt .Errorf ("beacon %d: Expected state for head block" , i )}
115- return
110+ if exists , err := beaconapi .FinalityCheckpoints (ctx , b .API , eth2api .StateIdRoot (headInfo .Header .Message .StateRoot ), & checkpoints ); err != nil || ! exists {
111+ if exists , err = beaconapi .FinalityCheckpoints (ctx , b .API , eth2api .StateIdSlot (headInfo .Header .Message .Slot ), & checkpoints ); err != nil {
112+ ch <- res {err : fmt .Errorf ("beacon %d: failed to poll finality checkpoint: %v" , i , err )}
113+ return
114+ } else if ! exists {
115+ ch <- res {err : fmt .Errorf ("beacon %d: Expected state for head block" , i )}
116+ return
117+ }
116118 }
117119
118120 var versionedBlock eth2api.VersionedSignedBeaconBlock
@@ -139,14 +141,16 @@ func (t *Testnet) WaitForFinality(ctx context.Context) (common.Checkpoint, error
139141 finalized = shorten (checkpoints .Finalized .String ())
140142 health , err := getHealth (ctx , b .API , t .spec , slot )
141143 if err != nil {
142- ch <- res {err : fmt .Errorf ("beacon %d: %s" , i , err )}
144+ // warning is printed here instead because some clients
145+ // don't support the required REST endpoint.
146+ fmt .Printf ("WARN: beacon %d: %s\n " , i , err )
143147 }
144148
145- ch <- res {i , fmt .Sprintf ("beacon %d: slot=%d, head=%s, health=%.2f, exec_payload=%s, justified=%s, finalized=%s" , i , slot , head , health , execution , justified , finalized ), nil }
146-
147149 ep := t .spec .SlotToEpoch (slot )
148150 if ep > 4 && ep > checkpoints .Finalized .Epoch + 2 {
149151 ch <- res {err : fmt .Errorf ("failed to finalize, head slot %d (epoch %d) is more than 2 ahead of finality checkpoint %d" , slot , ep , checkpoints .Finalized .Epoch )}
152+ } else {
153+ ch <- res {i , fmt .Sprintf ("beacon %d: slot=%d, head=%s, health=%.2f, exec_payload=%s, justified=%s, finalized=%s" , i , slot , head , health , execution , justified , finalized ), nil }
150154 }
151155
152156 if (checkpoints .Finalized != common.Checkpoint {}) {
0 commit comments