From 208133b6dac1b406359cb2b265442cb3b20fceca Mon Sep 17 00:00:00 2001 From: Evgeny Danienko <6655321@bk.ru> Date: Fri, 3 Jun 2022 14:15:56 +0300 Subject: [PATCH] fix --- eth/backend.go | 7 +++++++ tests/bor/bor_test.go | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/eth/backend.go b/eth/backend.go index bd941a6b11..fcba1c573b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -598,6 +598,13 @@ func (s *Ethereum) Start() error { // StartCheckpointWhitelistService starts the goroutine to fetch checkpoints and update the // checkpoint whitelist map. func (s *Ethereum) startCheckpointWhitelistService() { + // a shortcut helps with tests and early exit + select { + case <-s.closeCh: + return + default: + } + // first run the checkpoint whitelist err := s.handleWhitelistCheckpoint() if err != nil { diff --git a/tests/bor/bor_test.go b/tests/bor/bor_test.go index 7768b0fc9c..2d05baa490 100644 --- a/tests/bor/bor_test.go +++ b/tests/bor/bor_test.go @@ -37,10 +37,18 @@ func TestInsertingSpanSizeBlocks(t *testing.T) { engine := init.ethereum.Engine() _bor := engine.(*bor.Bor) + defer engine.Close() + h, heimdallSpan, ctrl := getMockedHeimdallClient(t) 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)