From b66707d952206aff6f6d466bf4b3844029df9eac Mon Sep 17 00:00:00 2001 From: rdlrt <3169068+rdlrt@users.noreply.github.com> Date: Sat, 30 Nov 2024 17:10:45 +1100 Subject: [PATCH] Add a restriction for delegators not in SDC to be limited to only new delegations (assuming older ones are in cache) --- files/grest/rpc/account/account_history.sql | 2 +- files/grest/rpc/pool/pool_delegators.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/grest/rpc/account/account_history.sql b/files/grest/rpc/account/account_history.sql index 849e4daa..9dd9f0e4 100644 --- a/files/grest/rpc/account/account_history.sql +++ b/files/grest/rpc/account/account_history.sql @@ -42,7 +42,7 @@ BEGIN ELSE RETURN QUERY SELECT - grest.cip5_hex_to_stake_addr(sa.hash_raw) AS stake_address, + grest.cip5_hex_to_stake_addr(sa.hash_raw)::varchar AS stake_address, JSONB_AGG( JSONB_BUILD_OBJECT( 'pool_id', b32_encode('pool', ph.hash_raw::text), diff --git a/files/grest/rpc/pool/pool_delegators.sql b/files/grest/rpc/pool/pool_delegators.sql index bd67bc67..a3504c45 100644 --- a/files/grest/rpc/pool/pool_delegators.sql +++ b/files/grest/rpc/pool/pool_delegators.sql @@ -115,6 +115,7 @@ BEGIN AND NOT EXISTS (SELECT null FROM stake_deregistration AS sd WHERE sd.addr_id = d.addr_id AND sd.tx_id > d.tx_id) -- AND NOT grest.is_dangling_delegation(d.id) AND NOT EXISTS (SELECT null FROM grest.stake_distribution_cache AS sdc WHERE sdc.stake_address_id = sa.id) + WHERE d.active_epoch_no > (SELECT MAX(no) FROM epoch) ) z, LATERAL grest.account_utxos(array[(SELECT grest.cip5_hex_to_stake_addr(z.stake_address_raw))], false) AS acc_info GROUP BY