Skip to content

Commit 7155c4e

Browse files
committed
fix(api): filter duplicated processed withdrawals
1 parent ef3f726 commit 7155c4e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

backend/pkg/api/data_access/vdb_withdrawals.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,16 @@ func (d *DataAccessService) GetValidatorDashboardClWithdrawals(ctx context.Conte
401401
if withdrawalsDs == nil {
402402
withdrawalsDs = requestsDs
403403
} else {
404-
withdrawalsDs = withdrawalsDs.UnionAll(requestsDs)
404+
// priority merge to filter out duplicated processed entries in both tables; keep all (manual) requests + unmatched skimmings
405+
withdrawalsDs = goqu.Dialect("postgres").From(goqu.T("request")).
406+
With("bridge", withdrawalsDs).
407+
With("request", requestsDs).
408+
UnionAll(goqu.Dialect("postgres").From(goqu.T("bridge")).
409+
Select(goqu.L("bridge.*")).
410+
LeftJoin(goqu.T("request"), goqu.Using(goqu.C("slot"), goqu.C("index"))).
411+
Where(
412+
goqu.I("request.slot").Eq(nil),
413+
))
405414
}
406415
}
407416

0 commit comments

Comments
 (0)