Skip to content

Commit f61ec91

Browse files
freemans13claudeoskarszoon
authored
Fix flaky test: Add missing ReportPeerFailure mock (#43)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: oskarszoon <1449115+oskarszoon@users.noreply.github.com>
1 parent 898f28a commit f61ec91

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

services/blockvalidation/catchup_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,8 @@ func TestServer_blockFoundCh_triggersCatchupCh(t *testing.T) {
707707
mockBlockchain.On("GetBestBlockHeader", mock.Anything).Return(dummyBlock.Header, &model.BlockHeaderMeta{Height: 1}, nil)
708708
mockBlockchain.On("GetBlockLocator", mock.Anything, mock.Anything, mock.Anything).Return([]*chainhash.Hash{dummyBlock.Hash()}, nil)
709709
mockBlockchain.On("GetBlockHeader", mock.Anything, mock.Anything).Return(dummyBlock.Header, &model.BlockHeaderMeta{Height: 1}, nil)
710+
// Mock ReportPeerFailure in case catchup fails (e.g., context cancellation)
711+
mockBlockchain.On("ReportPeerFailure", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe()
710712

711713
blockFoundCh := make(chan processBlockFound, 1)
712714
catchupCh := make(chan processBlockCatchup, 1)

0 commit comments

Comments
 (0)