How to restart mining without restarting sync?

Hi,

I am mining using the command given in beginners-guide-to-mining-block-collider document:

docker run --rm --name bcnode \
--memory-reservation="6900m" \
-p 3000:3000 -p 16060:16060 -p 16061:16061 -p 36061:36061 -p 36060:36060 \
-e BC_MINER_KEY="<YOUR_PUBLIC_ADDRESS>" \
-e BC_NETWORK="main" \
-e BC_FORCE_MINE=true \
-e MIN_HEALTH_NET=true \
-e NODE_OPTIONS=--max_old_space_size=6096 \
blockcollider/bcnode:latest \
start --rovers --rpc --ws --ui --node --scookie "scookie" 2>&1

.
Now whenever I stop the mining using docker stop bcnode and start it again with the above command, I see that sync start from block-1. Is there a way to restart mining without restarting the sync from start?

Hey there, @rahul, I would first suggest reading the following section from the CPU Local miner instructions that talks about downloading and importing the community snapshot:

This will save a lot of time and will always make sure you have the latest version of the chain.

However you should be able to simply add this line to you run command above "blockcollider\bcnode:latest " to save your synced data:

--mount source=db,target=/bc/_data \

Hope this helps!

-CW

Thanks @craig for the reply. I have few more doubts, if you can answer them:

  1. The link you provided also says “while very useful for speeding up sync times, is not a recommended feature.” So I thought of now using it. But looks like it’s safe to use it right?
  2. Can you tell me the default location where chain is downloaded in mac?
  3. It feels like even after I stop the docker, space is not freed up. You think we need to manually clean up the space in such cases?
  4. So, to make sure I understand it clearly, now if I use --mount source=db,target=/bc/_data \ argument in the command when restarting the mining, it will always start from the last synced block?

Thanks again for the clarification.

  1. Safe to use.
  2. Not sure if that exact folder is easy to access on docker, but it gets stored in ~/bc/_data
  3. Not sure what you mean clean up space. If anything, holding onto and running with the latest chain data will take up space.
  4. Yes, that should do it.