Skip to content

stop using mock blockchain - was causing data race#445

Open
freemans13 wants to merge 1 commit intobsv-blockchain:mainfrom
freemans13:stu/tests-remove-mock-blockchain
Open

stop using mock blockchain - was causing data race#445
freemans13 wants to merge 1 commit intobsv-blockchain:mainfrom
freemans13:stu/tests-remove-mock-blockchain

Conversation

@freemans13
Copy link
Collaborator

No description provided.

@freemans13 freemans13 self-assigned this Jan 28, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

🤖 Claude Code Review

Status: Complete


Issue Found:

Line 3082 adds a mock for a method that doesn't exist on the blockchain interface.

Details:

  • The blockchain interface has RevalidateBlock (lowercase 'v'), not ReValidateBlock (uppercase 'V')
  • More importantly, ReValidateBlock is a method on BlockValidation itself, not on the blockchain client interface
  • This mock is attempting to mock the wrong object and should be removed

See inline comment for details.

mockBlockchain.On("SetBlockSubtreesSet", mock.Anything, mock.Anything).Return(nil)
mockBlockchain.On("GetBestBlockHeader", mock.Anything).Return(&model.BlockHeader{}, &model.BlockHeaderMeta{Height: 100}, nil)

mockBlockchain.On("ReValidateBlock", mock.Anything, mock.Anything).Return()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mock line is incorrect and unnecessary. ReValidateBlock is a method on BlockValidation itself (BlockValidation.go:1631), not on the blockchain client interface. The blockchain interface has RevalidateBlock (lowercase v) at Interface.go:508. Remove this line.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant