harmony-one / harmony

The core protocol of harmony
https://harmony.one
GNU Lesser General Public License v3.0
1.46k stars 286 forks source link

Refactor NTP, support multiple NTP servers #4728

Closed GheisMohammadi closed 3 weeks ago

GheisMohammadi commented 1 month ago

Issue

This PR refactors the NTP functionality to support querying multiple NTP servers and addresses the NTP timeout issue commonly encountered in localnet. The PR also includes minor adjustments to error handling and logging for better troubleshooting and debugging.

Key Changes:

Frozen commented 1 month ago

Why it's better than just use time.Now() in localnet?

GheisMohammadi commented 1 month ago

Why it's better than just use time.Now() in localnet?

This PR addresses the issue for all networks and is not touching the logic. However, your suggestion is also great and valuable. I believe it’s acceptable to skip the time accuracy check on the localnet since all nodes are running on the same machine. I will apply this adjustment to the code.