e3: force merge snapshots before reconst (#818)

This commit is contained in:
Alex Sharov 2023-01-02 10:10:37 +07:00 committed by GitHub
parent 5b7297fbe2
commit ef2da9e625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1261,7 +1261,7 @@ type AggregatorStep struct {
keyBuf []byte
}
func (a *AggregatorV3) MakeSteps() []*AggregatorStep {
func (a *AggregatorV3) MakeSteps() ([]*AggregatorStep, error) {
to := a.maxTxNum.Load()
indexedMax := cmp.Min(
cmp.Min(a.accounts.endIndexedTxNumMinimax(), a.storage.endIndexedTxNumMinimax()),
@ -1272,22 +1272,21 @@ func (a *AggregatorV3) MakeSteps() []*AggregatorStep {
to = cmp.Min(to, indexedMax)
}
accountSteps := a.accounts.MakeSteps(to)
codeSteps := a.code.MakeSteps(to)
storageSteps := a.storage.MakeSteps(to)
if len(accountSteps) != len(storageSteps) || len(storageSteps) != len(codeSteps) {
return nil, fmt.Errorf("different amount of steps (try merge snapshots): accountSteps=%d, storageSteps=%d, codeSteps=%d", len(accountSteps), len(storageSteps), len(codeSteps))
}
steps := make([]*AggregatorStep, len(accountSteps))
for i, accountStep := range accountSteps {
steps[i] = &AggregatorStep{
a: a,
accounts: accountStep,
storage: storageSteps[i],
code: codeSteps[i],
}
}
storageSteps := a.storage.MakeSteps(to)
for i, storageStep := range storageSteps {
steps[i].storage = storageStep
}
codeSteps := a.code.MakeSteps(to)
for i, codeStep := range codeSteps {
steps[i].code = codeStep
}
return steps
return steps, nil
}
func (as *AggregatorStep) TxNumRange() (uint64, uint64) {