syncingDone() checks if the syncing loop may complete for a specific chainId
(maxHeight, minVDFIterations uint64)
| 707 | |
| 708 | // syncingDone() checks if the syncing loop may complete for a specific chainId |
| 709 | func (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 |
| 725 | func (c *Controller) finishSyncing() { |
no test coverage detected