diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 4b2b9b59f36be30d89ab0694aed20b7a2c42cd0e..03fddbf5d59a7ef0e120a10e1238989e91b17ec8 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1118,10 +1118,6 @@ func (c *Bor) CommitStates( chain chainContext, ) error { number := header.Number.Uint64() - if number < c.config.Sprint { - return errors.New("Requested to commit states too soon") - } - lastSync, err := c.genesisContractsClient.LastStateSyncTime(number - 1) if err != nil { return err diff --git a/consensus/bor/bor_test/bor_test.go b/consensus/bor/bor_test/bor_test.go index 9502812622244cc71ff4892c646c9b45130e5839..72b40d9560269c001d7a5ebd1d79af8bca5e1c22 100644 --- a/consensus/bor/bor_test/bor_test.go +++ b/consensus/bor/bor_test/bor_test.go @@ -3,8 +3,6 @@ package bortest import ( "encoding/hex" "fmt" - // "encoding/json" - // "fmt" "math/big" "testing" @@ -165,7 +163,7 @@ func getMockedHeimdallClient(t *testing.T) (*mocks.IHeimdallClient, *bor.Heimdal h := &mocks.IHeimdallClient{} h.On("FetchWithRetry", "bor", "span", "1").Return(res, nil) - res = zeroResultPayload(t) + res = stateSyncEventsPayload(t) // query := fmt.Sprintf("clerk/event-record/list?from-time=%d&to-time=%d&page=1&limit=50", 1, 1589709047) h.On("FetchWithRetry", mock.AnythingOfType("string")).Return(res, nil) return h, heimdallSpan diff --git a/consensus/bor/bor_test/helper.go b/consensus/bor/bor_test/helper.go index f95bf6cb05edd3bcc0260c5b3b2a7fff11f14921..d02c3463fc4e942ebab69c34c9f2952e62b55c4e 100644 --- a/consensus/bor/bor_test/helper.go +++ b/consensus/bor/bor_test/helper.go @@ -156,7 +156,7 @@ func sign(t *testing.T, header *types.Header, signer []byte) { copy(header.Extra[len(header.Extra)-extraSeal:], sig) } -func zeroResultPayload(t *testing.T) *bor.ResponseWithHeight { +func stateSyncEventsPayload(t *testing.T) *bor.ResponseWithHeight { stateData, err := ioutil.ReadFile("states.json") if err != nil { t.Fatalf("%s", err) diff --git a/consensus/bor/genesis_contracts_client.go b/consensus/bor/genesis_contracts_client.go index 3e2606c07988ed23d9d8dc1b494789b6f52b3ddc..d616c6f12e10f60db5f525030c5d732ccb00b6b8 100644 --- a/consensus/bor/genesis_contracts_client.go +++ b/consensus/bor/genesis_contracts_client.go @@ -5,7 +5,6 @@ import ( "math" "math/big" - // "math/big" "strings" "time" @@ -65,8 +64,6 @@ func (gc *GenesisContractsClient) CommitState( method := "commitState" t := event.Time.Unix() data, err := gc.stateReceiverABI.Pack(method, recordBytes, big.NewInt(0).SetInt64(t)) - // t, err := time.Parse(event.Time, time.RFC3339) - // data, err := gc.stateReceiverABI.Pack(method, recordBytes, t.Unix()) if err != nil { log.Error("Unable to pack tx for commitState", "error", err) return err