@@ -397,7 +397,14 @@ func (d *DataAccessService) GetValidatorDashboardClWithdrawals(ctx context.Conte
397397 if withdrawalsDs == nil {
398398 withdrawalsDs = requestsDs
399399 } else {
400- // priority merge to filter out duplicated processed entries in both tables; keep all (manual) requests + unmatched skimmings
400+ // first filter out processed exits
401+ withdrawalsDs = withdrawalsDs .Where (goqu .L ("NOT EXISTS (?)" , goqu .
402+ From (goqu .T ("blocks_exit_requests" ).As ("ber" )).
403+ Where (
404+ goqu .I ("v.pubkey" ).Eq (goqu .I ("ber.validator_pubkey" )),
405+ ),
406+ ))
407+ // then priority merge to filter out duplicated processed skimmings in both tables; keep all (manual) requests + unmatched skimmings
401408 withdrawalsDs = goqu .Dialect ("postgres" ).From (goqu .T ("request" )).
402409 With ("bridge" , withdrawalsDs ).
403410 With ("request" , requestsDs ).
@@ -707,7 +714,9 @@ func getWithdrawalRequestsDs(dashboardId t.VDBId, search string, isValidSearchWi
707714 goqu .On (
708715 goqu .I ("wr.validator_pubkey" ).Eq (goqu .I ("v.pubkey" )),
709716 ),
710- )
717+ ).
718+ // TODO remove, shouldn't even live in that table
719+ Where (goqu .I ("wr.amount" ).Neq (goqu .V (0 ))) // filter out exit requests
711720
712721 if dashboardId .Validators != nil {
713722 withdrawalRequestsDs = withdrawalRequestsDs .Where (
@@ -1011,7 +1020,8 @@ func (d *DataAccessService) GetValidatorDashboardTotalClWithdrawals(ctx context.
10111020 goqu .SUM (goqu .I ("withdrawals_amount" )).As ("acc_withdrawals_amount" ),
10121021 goqu .MAX (goqu .I ("epoch_end" )).As ("epoch_end" ),
10131022 ).
1014- GroupBy (goqu .I ("validator_index" ))
1023+ GroupBy (goqu .I ("validator_index" )).
1024+ Where (goqu .L ("finalizeAggregation(balance_end) != 0" ))
10151025
10161026 if dashboardId .Validators == nil {
10171027 withdrawalsDs = withdrawalsDs .
0 commit comments