Skip to content

fix(smartbft): implement Errored() on BFTChain#5451

Open
FirePheonix wants to merge 1 commit intohyperledger:mainfrom
FirePheonix:fix/smartbft-errored-impl
Open

fix(smartbft): implement Errored() on BFTChain#5451
FirePheonix wants to merge 1 commit intohyperledger:mainfrom
FirePheonix:fix/smartbft-errored-impl

Conversation

@FirePheonix
Copy link
Copy Markdown
Contributor

  • Improvement (improvement to code, performance, etc)
    Added a new test

Description

Errored() on BFTChain had a // TODO: Implement Errored stub returning nil since SmartBFT was introduced.

The Deliver service uses this channel to detect when a consenter stops and terminate waiting clients, returning nil meant BFT chains were invisible to the Deliver client on halt.

This PR resolves the TODO by adding exitC chan struct{} to BFTChain, initialized in NewChain(), closed in Halt() (double-close safe via select), and returned by Errored().
This thng actually pattern mirrors the existing etcdraft Chain implementation.

@FirePheonix FirePheonix requested a review from a team as a code owner April 6, 2026 22:04
@tock-ibm tock-ibm requested a review from Copilot April 9, 2026 11:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements the consensus.Chain Errored() signal for SmartBFT so Deliver clients can detect when a BFT chain halts and stop waiting.

Changes:

  • Added an exitC channel to BFTChain, initialized in NewChain(), returned by Errored().
  • Closed exitC during Halt() in a double-close-safe way.
  • Added a unit/integration test validating Errored() behavior before/after Halt() and that repeated Halt() does not panic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
orderer/consensus/smartbft/chain.go Adds/returns a halt/error notification channel and closes it on shutdown.
orderer/consensus/smartbft/chain_test.go Adds coverage for Errored() channel semantics across Halt().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants