From e6da1f68eb800cf9422c0b368a2b5c7677a2dc06 Mon Sep 17 00:00:00 2001 From: Alice Date: Sun, 6 Sep 2026 06:25:20 +0700 Subject: [PATCH] fix(bft): return error when committee loading fails Previously, errors from LoadCommittee() and LoadCommitteeData() were only logged as warnings, allowing the BFT to continue with a potentially nil validator set. This could lead to panics when the validator set is used later. Now returns from Start() on committee loading failures, preventing the BFT from running with an invalid state. --- bft/bft.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bft/bft.go b/bft/bft.go index 011966cff4..f15ff5d4d4 100644 --- a/bft/bft.go +++ b/bft/bft.go @@ -126,12 +126,14 @@ func (b *BFT) Start() { // load the committee from the base chain b.ValidatorSet, err = b.Controller.LoadCommittee(b.LoadRootChainId(b.ChainHeight()), b.Controller.RootChainHeight()) if err != nil { - b.log.Warn(err.Error()) + b.log.Error(err.Error()) + return } // load the committee data b.CommitteeData, err = b.Controller.LoadCommitteeData() if err != nil { - b.log.Warn(err.Error()) + b.log.Error(err.Error()) + return } for { select {