Skip to content

Commit

Permalink
EVM-434-fix syncer problem
Browse files Browse the repository at this point in the history
  • Loading branch information
stana-miric committed Feb 6, 2023
1 parent 3a064f9 commit 860c4cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion consensus/polybft/polybft.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (p *Polybft) startConsensusProtocol() {
case ev := <-eventCh:
// The blockchain notification system can eventually deliver
// stale block notifications. These should be ignored
if ev.Source == "syncer" && ev.NewChain[0].Number > p.blockchain.CurrentHeader().Number {
if ev.Source == "syncer" && ev.NewChain[0].Number >= p.blockchain.CurrentHeader().Number {
syncerBlockCh <- struct{}{}
}
}
Expand Down
8 changes: 6 additions & 2 deletions e2e-polybft/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ func TestE2E_Consensus_RegisterValidator(t *testing.T) {
require.NoError(t, srv.RegisterValidator(newValidatorSecrets, newValidatorBalanceRaw, newValidatorStakeRaw))

// wait for an end of epoch so that stake gets finalized
cluster.WaitForBlock(5, 1*time.Minute)
currentBlock, err := srv.JSONRPC().Eth().BlockNumber()
require.NoError(t, err)
cluster.WaitForBlock(currentBlock+5, 1*time.Minute)

// start new validator
cluster.InitTestServer(t, 6, true, false)
Expand Down Expand Up @@ -184,7 +186,9 @@ func TestE2E_Consensus_RegisterValidator(t *testing.T) {
require.Equal(t, newValidatorStake, newValidatorInfo.TotalStake)

// wait 3 more epochs, so that rewards get accumulated to the registered validator account
cluster.WaitForBlock(20, 2*time.Minute)
currentBlock, err = srv.JSONRPC().Eth().BlockNumber()
require.NoError(t, err)
cluster.WaitForBlock(currentBlock+15, 2*time.Minute)

// query registered validator
newValidatorInfo, err = sidechain.GetValidatorInfo(newValidatorAddr, txRelayer)
Expand Down

0 comments on commit 860c4cd

Please sign in to comment.