-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(monitor): bootstrap monitor from db #34
Conversation
…/monitor-stored-bootstrap
monitor/monitor.go
Outdated
// get the height from db if it exists otherwise use the baseHeight provided from genesis | ||
var startHeight uint64 | ||
dbHeight, exists, err := m.store.LatestHeight() | ||
if err != nil { | ||
panic(fmt.Errorf("error getting latest height from db %w", err)) | ||
} else if !exists { | ||
startHeight = baseHeight | ||
} else { | ||
startHeight = dbHeight | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to extract this into a func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using the KVStore
to be similar to what is being used in the Babylon code?
besides that, only a few suggestions that are no impediments to merge! 🎉
Nice suggestion, but I've seen that we use this in our btc-staker and indexer, Konrad suggested to go with it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Some minor comments:
@@ -34,6 +34,7 @@ var ( | |||
eventuallyWaitTimeOut = 40 * time.Second | |||
eventuallyPollTime = 1 * time.Second | |||
regtestParams = &chaincfg.RegressionNetParams | |||
defaultEpochInterval = uint(400) //nolint:unused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultEpochInterval = uint(400) //nolint:unused | |
defaultEpochInterval = uint(400) |
This PR enables the monitor to start from the last processed confirmed header, we also save the epoch
References issue.