From bb6a18dbf90bc6382d078813d53bcac3b9f44480 Mon Sep 17 00:00:00 2001 From: remoterami <142154971+remoterami@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:28:55 +0100 Subject: [PATCH] fix(api): early out if RP isn't deployed --- backend/pkg/api/data_access/vdb_rocket_pool.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/pkg/api/data_access/vdb_rocket_pool.go b/backend/pkg/api/data_access/vdb_rocket_pool.go index ec9d2a5a3..42fd5f873 100644 --- a/backend/pkg/api/data_access/vdb_rocket_pool.go +++ b/backend/pkg/api/data_access/vdb_rocket_pool.go @@ -15,7 +15,17 @@ import ( "golang.org/x/sync/errgroup" ) +func rocketPoolDeployed(ctx context.Context, d *DataAccessService) (bool, error) { + var rpDeployed bool + err := d.alloyReader.GetContext(ctx, &rpDeployed, "select count(*) > 0 from rocketpool_onchain_configs") + return rpDeployed, err +} + func (d *DataAccessService) GetValidatorDashboardRocketPool(ctx context.Context, dashboardId t.VDBId, cursor string, colSort t.Sort[enums.VDBRocketPoolColumn], search string, limit uint64) ([]t.VDBRocketPoolTableRow, *t.Paging, error) { + if deployed, err := rocketPoolDeployed(ctx, d); err != nil || !deployed { + return []t.VDBRocketPoolTableRow{}, &t.Paging{}, err + } + // Initialize the cursor var currentCursor t.RocketPoolCursor var err error