Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Various data integrity checks #9

Open
mkrump opened this issue Jan 30, 2018 · 0 comments
Open

Various data integrity checks #9

mkrump opened this issue Jan 30, 2018 · 0 comments

Comments

@mkrump
Copy link
Contributor

mkrump commented Jan 30, 2018

Maybe Add some data verification for the final database? Was thinking could maybe try to do a simple verification of the parent hash on the block vs. the previous block in db like below. Also, was manually checking total difficulty against etherscan, like the 2nd query, but maybe this could be automated.

--parent hash on block should match has of previous block
SELECT
  block_number,
  block_hash,
  block_parenthash,
  parent
FROM (
       SELECT
         block_hash,
         lag(block_hash)
         OVER (
           ORDER BY block_number ) AS parent,
         block_parenthash,
         block_number
       FROM blocks
     ) a
WHERE parent != block_parenthash
ORDER BY block_number;
--block cumulative difficulty ** can use as qc
SELECT *
FROM (
       SELECT
         block_number,
         to_char(sum(block_difficulty)
                 OVER (
                   ORDER BY block_number ), '999,999,999,999,999,999,999,999')
       FROM blocks
     ) a
WHERE block_number IN (
  4750712,
  4756962,
  4763212,
  4765177,
  4766503
);
i-norden added a commit that referenced this issue Apr 9, 2019
i-norden added a commit that referenced this issue Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants