diff --git a/tests/rpc/rpc_01-system_test.go b/tests/rpc/rpc_01-system_test.go index a73c8f977f6..e6dcc988349 100644 --- a/tests/rpc/rpc_01-system_test.go +++ b/tests/rpc/rpc_01-system_test.go @@ -103,11 +103,19 @@ func TestSystemRPC(t *testing.T) { return false, nil // retry } - bestBlockNumber := response[0].BestNumber - for _, peer := range response { + bestBlockNumbers := make([]uint64, len(response)) + for i, peer := range response { // wait for all peers to have the same best block number - sameBestBlockNumber := bestBlockNumber == peer.BestNumber - if peer.PeerID == "" || peer.BestHash.IsEmpty() || !sameBestBlockNumber { + bestBlockNumbers[i] = peer.BestNumber + if peer.PeerID == "" || peer.BestHash.IsEmpty() { + return false, nil // retry + } + } + + mustEqualBlockNumber := bestBlockNumbers[0] + for _, bestBlockNumber := range bestBlockNumbers { + if mustEqualBlockNumber != bestBlockNumber { + t.Logf("Best block numbers are not equal: %v", bestBlockNumbers) return false, nil // retry } }