This commit is contained in:
Evgeny Danienko 2022-06-03 14:15:56 +03:00
parent 01b6d6cb72
commit 208133b6da
2 changed files with 16 additions and 1 deletions

View file

@ -598,6 +598,13 @@ func (s *Ethereum) Start() error {
// StartCheckpointWhitelistService starts the goroutine to fetch checkpoints and update the // StartCheckpointWhitelistService starts the goroutine to fetch checkpoints and update the
// checkpoint whitelist map. // checkpoint whitelist map.
func (s *Ethereum) startCheckpointWhitelistService() { func (s *Ethereum) startCheckpointWhitelistService() {
// a shortcut helps with tests and early exit
select {
case <-s.closeCh:
return
default:
}
// first run the checkpoint whitelist // first run the checkpoint whitelist
err := s.handleWhitelistCheckpoint() err := s.handleWhitelistCheckpoint()
if err != nil { if err != nil {

View file

@ -37,10 +37,18 @@ func TestInsertingSpanSizeBlocks(t *testing.T) {
engine := init.ethereum.Engine() engine := init.ethereum.Engine()
_bor := engine.(*bor.Bor) _bor := engine.(*bor.Bor)
defer engine.Close()
h, heimdallSpan, ctrl := getMockedHeimdallClient(t) h, heimdallSpan, ctrl := getMockedHeimdallClient(t)
defer ctrl.Finish() defer ctrl.Finish()
h.EXPECT().FetchLatestCheckpoint().Return(&bor.Checkpoint{}, nil).AnyTimes() _, span := loadSpanFromFile(t)
h.EXPECT().FetchLatestCheckpoint().Return(&bor.Checkpoint{
Proposer: span.SelectedProducers[0].Address,
StartBlock: big.NewInt(0),
EndBlock: big.NewInt(int64(spanSize)),
}, nil).Times(1)
_bor.SetHeimdallClient(h) _bor.SetHeimdallClient(h)