Add a migration to mark all invalid blocks as non-consensus (#1644)

pull/1657/head
goodsoft 6 years ago
parent e1d13a3d7f
commit fe25bf7b44
No known key found for this signature in database
GPG Key ID: DF5159A3A5F09D21
  1. 6
      apps/explorer/priv/repo/migrations/scripts/20190326202921_lose_consensus_for_invalid_blocks.sql

@ -0,0 +1,6 @@
UPDATE blocks SET consensus = FALSE
WHERE number IN (
SELECT b0.number - 1 FROM "blocks" AS b0
LEFT JOIN "blocks" AS b1 ON (b0."parent_hash" = b1."hash") AND b1."consensus"
WHERE b0."number" > 0 AND b0."consensus" AND b1."hash" IS NULL
);
Loading…
Cancel
Save