Merge pull request #127 from maticnetwork/arpit/fix-override-syncevents

add overrideStateSyncRecords to genesis
This commit is contained in:
Arpit Temani 2021-05-28 11:42:12 +05:30 committed by GitHub
commit 125e79236e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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.