MCPcopy
hub / github.com/canopy-network/canopy / syncingDone

Method syncingDone

controller/consensus.go:709–722  ·  view source on GitHub ↗

syncingDone() checks if the syncing loop may complete for a specific chainId

(maxHeight, minVDFIterations uint64)

Source from the content-addressed store, hash-verified

707
708// syncingDone() checks if the syncing loop may complete for a specific chainId
709func (c *Controller) syncingDone(maxHeight, minVDFIterations uint64) bool {
710 // if the plugin height is GTE the max height
711 if c.FSM.Height() >= maxHeight {
712 // ensure node did not lie about VDF iterations in their chain
713 if c.FSM.TotalVDFIterations() < minVDFIterations {
714 // if the node lied, on unsafe fork - exit application immediately for safety
715 c.log.Fatalf("Unsafe fork detected - VDFIterations error: localVDFIterations: %d, minimumVDFIterations: %d", c.FSM.TotalVDFIterations(), minVDFIterations)
716 }
717 // exit with syncing done
718 return true
719 }
720 // exit with syncing not done
721 return false
722}
723
724// finishSyncing() is called when the syncing loop is completed for a specific chainId
725func (c *Controller) finishSyncing() {

Callers 1

SyncMethod · 0.95

Calls 3

TotalVDFIterationsMethod · 0.80
FatalfMethod · 0.65
HeightMethod · 0.45

Tested by

no test coverage detected