Description
This is not a bug but a feature request aiming at having more users in sync, faster and more consistently, especially for those not operating nodes running 100% of the time.
Similar issue reported for parity: openethereum/parity-ethereum#8244
In the early days, Geth has been built as a node and the priority was/is obviously to never stop or break.Today, if we consider the users operating nodes on servers, this is still critical that geth nodes never stops.
We also need to consider another class of users: those who use Geth daily (or almost) and start/stop geth all the time. For those, it used to be fast syncing their node: a few minutes or an hour at max would fetch a good week or too of blocks.
This is no longer the case. Nowadays, not syncing every day becomes quickly painful.
I propose the addition of a new flag that would stop and exit when the chain has been caught up.
It could something like:
geth --exit-when-synced N
With N being the number of seconds to keep running once the chain is in sync. N=0 means geth exists immediately once the chain is caught up.
Having this flag means users could sync all their geth chains (fundation, ropsten, rinkeby) overnight on a single machine by simply chaining the syncs:
geth --rinkeby --exit-when-synced 15 && \
geth --ropsten --exit-when-synced 15 && \
geth --exit-when-synced
Once all the syncs are done, the poor (but warm) laptop could go back to rest for a good part of the night.
Recently, as a workaround to that, I published https://github.com/chevdor/ethup. One benefit of ethup
is that it supports parity as well but I think it would be more elegant to have a solution directly in geth, without having to install additional npm packages.