Support starting node at particular block
tarrencev opened this issue · 2 comments
tarrencev commented
Is your feature request related to a problem? Please describe.
Currently, the node always starts at block 0. It would be great to be able to start it at a particular block.
Describe the solution you'd like
- Update
start
to takeBlockIngestionConfig
as input - Update
BlockIngestionConfig
to allow specifying thestart_block
- Use start block if set rather than 0
robinstraub commented
Hello there, I'll gladly work on this one.
fracek commented
Thank you for this! The way I would tackle this is as following:
- Add the option to the
StartCommand
inbin.rs
. I think a good name is--ingest-from-block
. - Update
BlockIngestionConfig
with the new option. - Most of the work will be in
ingestion/started.rs
. This is responsible for starting the actual ingestion:- replace the initial call to
ingest_genesis_block
to a conditional call: if theingest-from-block
option is None then ingest genesis, otherwise ingest from the block specified by the user. - if the user specified a block, check it's finalized before ingesting it. This is to have a stable point in case of reorg.
- replace the initial call to
- In
stream/filtered.rs
we need to check if the stream's starting cursor is earlier than theingest-from-block
block. You can do that inreconfigure_data_stream
and if the cursor is too early, return an error to the user.