"Unable to get difficulty" error logged in docker logs

The architecture of EON blockchain is node-centric. Nodes (or peers) perform a variety of tasks including the validation of transactions which earns rewards for their owners. To start, one needs to deploy an EON node (also called a masternode) progressing through the steps described in Deploying an EON node (peer) on a Linux based host.

Once the node has been deployed, it may encounter errors, which may disrupt the process of generating blocks. One of the errors is Unable to get difficulty error logged to docker logs.

There is a way to get logs by exporting them to a file:

To create a log file execute the following 2 commands:

1. Find a container, from where you want to extract a log from:

docker ps [OPTIONS]

where 'Options':
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
--help Print usage
-n, --last int Show n last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes

2. Execute a log from the container to a file log.txt:

docker logs [OPTIONS] CONTAINER > log.txt

where 'Options':
--details Show extra details provided to logs
-f, --follow Follow log output
--help Print usage
--since string Show logs since timestamp
--tail string Number of lines to show from the end of the logs (default "all")
-t, --timestamps Show timestamps

'Container' is the container found in step 1.

This article describes the cause and the solution for it.

Cause

The Unable to get difficulty error entry followed by an IP address means that another peer 195.123.xxx.xxx from EON blockchain was unavailable at the moment. A log entry for such an error may look like this:

19:38:58.374 [ForkJoinPool.commonPool-worker-0]
WARN com.exscudo.peer.core.importer.tasks.SyncBlockListTask - Unable to get difficulty: 195.123.???.???:9443
java.io.IOException: java.net.SocketTimeoutException: connect timed out at com.exscudo.jsonrpc.JrpcServiceProxy.post(JrpcServiceProxy.java:149) ~[classes/:?] at com.exscudo.eon.app.jsonrpc.proxy.PeerServiceProxy.doRequest(PeerServiceProxy.java:28) ~[classes/:?]
at com.exscudo.eon.app.jsonrpc.proxy.BlockSynchronizationServiceProxy.getDifficulty(BlockSynchronizationServiceProxy.java:22) ~[classes/:?] at com.exscudo.peer.core.importer.tasks.SyncBlockListTask$1.get(SyncBlockListTask.java:129) [classes/:?] at com.exscudo.peer.core.importer.tasks.SyncBlockListTask$1.get(SyncBlockListTask.java:123) [classes/:?] at java.util.concurrent.CompletableFuture$<<$1>$1>Supply.run(CompletableFuture.java:1590)$1></$1>

*Difficulty here refers to the cumulative difficulty algorithm of EON blockchain. See The cumulative difficulty algorithm of EON blockchain for details.

Solution

As the accessibility of other peers on the blockchain is a factor that is not directly related to your own peer, this error can be ignored if not repeated. Otherwise, if the errors in connecting to other peers are multiple and repeated, it may indicate that your peer is experiencing difficulties connecting to the Internet.