From e0f7a001533ff3d63a9160ff72db027f37293f55 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Thu, 27 May 2021 17:56:09 +0530 Subject: [PATCH] add overrideStateSyncRecords to genesis --- consensus/bor/bor.go | 6 ++++++ params/config.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 3d82258779..5b2bf3aa72 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -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 { diff --git a/params/config.go b/params/config.go index 6fc771a658..3b31d4e801 100644 --- a/params/config.go +++ b/params/config.go @@ -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.