Skip to content

Commit

Permalink
Couple of chores fixes:
Browse files Browse the repository at this point in the history
1. active stake cache => epoch_active_stake_cache should populate from scratch on fresh run
2. tx_info => collateral_tx_out.multi_assets_descr cannot be conclusively formatted as JSONB, format them as text array instead
  • Loading branch information
rdlrt committed Sep 4, 2024
1 parent 449d79a commit 613ff7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion files/grest/rpc/01_cached_tables/active_stake_cache.sql
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ BEGIN
epoch_stake.epoch_no,
SUM(epoch_stake.amount) AS amount
FROM public.epoch_stake
WHERE epoch_stake.epoch_no >= _last_active_stake_validated_epoch
WHERE epoch_stake.epoch_no >= COALESCE(
(SELECT last_value::integer
FROM grest.control_table
WHERE key = 'last_active_stake_validated_epoch'), 0)
AND epoch_stake.epoch_no <= _epoch_no
GROUP BY epoch_stake.epoch_no
ON CONFLICT (epoch_no) DO UPDATE
Expand Down
2 changes: 1 addition & 1 deletion files/grest/rpc/transactions/tx_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ BEGIN
)
END
) AS reference_script,
REPLACE(tx_out.multi_assets_descr,'fromList ','')::jsonb AS asset_descr
REPLACE(tx_out.multi_assets_descr,'fromList ','')::text AS asset_descr
FROM
collateral_tx_out AS tx_out
INNER JOIN tx ON tx_out.tx_id = tx.id
Expand Down

0 comments on commit 613ff7b

Please sign in to comment.