add overrideStateSyncRecords to genesis

This commit is contained in:
Arpit Temani 2021-05-27 17:56:09 +05:30
parent 6981906728
commit e0f7a00153
2 changed files with 8 additions and 0 deletions

View file

@ -11,6 +11,7 @@ import (
"math"
"math/big"
"sort"
"strconv"
"strings"
"sync"
"time"
@ -1123,6 +1124,11 @@ func (c *Bor) CommitStates(
"fromID", lastStateID+1,
"to", to.Format(time.RFC3339))
eventRecords, err := c.HeimdallClient.FetchStateSyncEvents(lastStateID+1, to.Unix())
if c.config.OverrideStateSyncRecords != nil {
if val, ok := c.config.OverrideStateSyncRecords[strconv.FormatUint(number, 10)]; ok {
eventRecords = eventRecords[0:val]
}
}
chainID := c.chainConfig.ChainID.String()
for _, eventRecord := range eventRecords {

View file

@ -369,6 +369,8 @@ type BorConfig struct {
BackupMultiplier uint64 `json:"backupMultiplier"` // Backup multiplier to determine the wiggle time
ValidatorContract string `json:"validatorContract"` // Validator set contract
StateReceiverContract string `json:"stateReceiverContract"` // State receiver contract
OverrideStateSyncRecords map[string]int `json:"overrideStateSyncRecords"` // override state records count
}
// String implements the stringer interface, returning the consensus engine details.