File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed
Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -829,26 +829,28 @@ func getLastReferencedMetaHash(
829829 return nil , epochStart .ErrWrongTypeAssertion
830830 }
831831
832+ var lastReferencedMetaHash []byte
833+
832834 currentHdr := lastExecutedShardHeader
833- for {
835+ for currentHdr . GetNonce () > 0 {
834836 numIncludedMetaBlocks := len (currentHdr .GetMetaBlockHashes ())
835837
836- // if there are no included meta blocks, go to prev header
837- if numIncludedMetaBlocks == 0 {
838- header , err := fetchPrevHeader (syncedHeaders , currentHdr )
839- if err != nil {
840- return nil , err
841- }
842-
843- currentHdr = header
844- continue
838+ // if there are notarized meta headers, return last included meta header
839+ if numIncludedMetaBlocks > 0 {
840+ lastReferencedMetaHash = currentHdr .GetMetaBlockHashes ()[numIncludedMetaBlocks - 1 ]
841+ break
845842 }
846843
847- // if there are notarized meta headers, return last included meta header
848- metaHash := currentHdr .GetMetaBlockHashes ()[numIncludedMetaBlocks - 1 ]
844+ // if there are no included meta blocks, go to prev header
845+ header , err := fetchPrevHeader (syncedHeaders , currentHdr )
846+ if err != nil {
847+ return nil , err
848+ }
849849
850- return metaHash , nil
850+ currentHdr = header
851851 }
852+
853+ return lastReferencedMetaHash , nil
852854}
853855
854856func (e * epochStartBootstrap ) syncPrevShardHeaderHandler (
You can’t perform that action at this time.
0 commit comments