diff --git a/cmd/lotus-chainwatch/syncer/sync.go b/cmd/lotus-chainwatch/syncer/sync.go index 52a36fc9e..306cf8b3e 100644 --- a/cmd/lotus-chainwatch/syncer/sync.go +++ b/cmd/lotus-chainwatch/syncer/sync.go @@ -136,7 +136,8 @@ create unique index if not exists block_cid_uindex on blocks (cid,height); create materialized view if not exists state_heights - as select distinct height, parentstateroot from blocks; + as select b.parentstateroot, min(b.height) height + from blocks b group by b.parentstateroot; create index if not exists state_heights_height_index on state_heights (height);