[Ethereum] Proper way to stop the Geth console to turn off computer for maintenance

synchronization

After the synchronization of block chain is complete, what happens if you close the geth console while it continues to run the current block chain data?

In the future, I would like to turn off synchronization and close the command prompt geth console so that I can do maintenance on the system.

Is there some duration of time where you can have your system turned off and still start synchronizing again at the last block chain found on your system?

I guess I am asking because it seems that after I had finished synchronization and it was processing through a block, I closed the geth command prompt window.

I then tried to restart geth console and it seems to find the most recent local full block (which on my system seems to be 4058127)

It then goes through this process:

INFO [07-22|11:58:30] IPC endpoint opened: \\.\pipe\geth.ipc
INFO [07-22|11:58:30] HTTP endpoint opened: http://127.0.0.1:8545
INFO [07-22|11:58:30] Mapped network port                      proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.2.1)
INFO [07-22|12:01:00] Block synchronisation started
INFO [07-22|12:01:03] Imported new chain segment               blocks=2 txs=148 mgas=12.617 elapsed=303.788ms mgasps=41.532 number=4058129 hash=ac2f90…89e00a
WARN [07-22|12:01:08] Synchronisation failed, dropping peer    peer=1cd4c9e09b903579 err="retrieved hash chain is invalid"
WARN [07-22|12:05:13] Synchronisation failed, dropping peer    peer=416475e24fa54674 err="retrieved hash chain is invalid"
WARN [07-22|12:10:49] Synchronisation failed, retrying         err="block download canceled (requested)"

It doesn't seem to be able to sync now and it keeps dropping peers.

Does this 'handshake' process just take a long time or did I kind of mess up by stopping the geth console and then trying to restart it.

If it is just a question of patience vs. restarting from scratch, what general time frame should I expect before the handshake completes and I can catch up again to the end of the block chain.

Cheers,
John

Best Answer

Running geth keeps the local copy of the chain in sync with the global chain when it is running. geth console is a REPL which connects to an instance of geth and allows you to run commands in the context of the blockchain. Closing geth console using Ctrl + C or Ctrl + D will not stop the synchronization process. If you kill the geth command (for example by closing the shell it is running in), synchronization will stop. Otherwise, geth will keep the local copy blockchain of the blockchain up to date, even after being disconnected from the network for a long time. You will just have to wait for the peer discovery process to finish and the new blocks to be pulled in from the network. It takes a while.

Related Topic