2

Does geth have a mode where you can tell it to sync only up to a particular block number and then stop syncing (and still serve queries about the blocks it has)? Or a mode where you can tell it to always stay N blocks behind the latest mainnet block? Or a mode where it says running but only syncs up to block numbers that it's given dynamically?

(Or - does geth have fine-grained control over when to accept a new block?)

1
  • no, but you can try to insert a time.Sleep() function somewhere in the sources to achieve the desired behavior
    – Nulik
    Feb 11 '21 at 14:54
2

Geth hasn't options in command line for it. But you can above control sync(calling {"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}) and exit to geth process when it has needed blocks. And after you could start it without connection with other peers if you dont want receive new blocks.

1
  • 1
    I don't know how you could use eth_syncing to do this. It tells you when geth is syncing, but doesn't give you any ability to control syncing (other than killing the process, I guess). If you want to sync to block 10000, stop, then advance to block 11000, I don't see how eth_syncing helps you. (There's a timing issue, so even if you start at block 0 and wait until you see block 10000, then kill the process, there's no way to ensure that you didn't sync to block 10001.) Feb 11 '21 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.