A promise that resolves to the list of connected peers.
isHealthy
isHealthy(): Promise<boolean>
Checks the health of a node using the following algorithm:
Make an HTTP GET request to retrieve the last block timestamp.
Calculates the difference between the current time and the last block timestamp.
If the difference is less than the tolerance, the node is healthy.
Note, we could also check '/node/network/peers since' but the difficulty with this approach is
if you consider a scenario where the node is connected to 20+ peers, which is healthy, and it receives the new blocks as expected.
But what if the node's disk is full, and it's not writing the new blocks to its database? In this case the node is off-sync even
though it's technically alive and connected
The
NodesModule
class serves as a module for node-related functionality, for example, checking the health of a node.