CityOfZion / neo-scan

Blockchain explorer for NEO
https://neoscan.io
MIT License
70 stars 65 forks source link

Some blocks are showing negative time between blocks #372

Open vncoelho opened 6 years ago

vncoelho commented 6 years ago

image

There should be something in the calculus, it just happens in some pages of our privatenet.

adrienmo commented 6 years ago

@vncoelho The block time is given by this sql query:

https://github.com/CityOfZion/neo-scan/blob/master/apps/neoscan/lib/neoscan/blocks/blocks.ex#L92

would it be possible for you to check in the postgres database to check the block time and see if the time is correct (block with higher index have always a higher timestamp)? Would it be possible that different neo nodes have different clocks and are not registering the same time for a block?

vncoelho commented 6 years ago

I will, @adrienmo, what is the best way to query this once I am inside the postgres docker?

But the timestamp on the screenshot looks correct, that is the strange thing.

adrienmo commented 6 years ago

psql -h 127.0.0.1 -U postgres -d neoscan_prodv password: postgres

And then you can run this command:

select index,time,extract(epoch FROM (time - lead(time) OVER ()))::integer as lag from blocks order by index desc limit 15;

It's indeed weird that on the screenshot everything looks correct for the time.

vncoelho commented 6 years ago

I am trying to replicate, as soon as it happens I will update here, @adrienmo.

Thanks for the tip and attention.

vncoelho commented 5 years ago

image

@adrienmo, How to select a specific epoch in that command you sent above?

vncoelho commented 5 years ago
73 | 2018-12-13 12:42:30 | 1544704950
    72 | 2018-12-13 12:42:27 | 1544704947
    71 | 2018-12-13 12:42:24 | 1544704944
    70 | 2018-12-13 12:42:20 | 1544704940
    69 | 2018-12-13 12:42:17 | 1544704937
    68 | 2018-12-13 12:42:14 | 1544704934
    67 | 2018-12-13 12:42:11 | 1544704931
    66 | 2018-12-13 12:42:08 | 1544704928
    65 | 2018-12-13 12:42:05 | 1544704925
    64 | 2018-12-13 12:42:02 | 1544704922
    63 | 2018-12-13 12:41:59 | 1544704919
    62 | 2018-12-13 12:41:55 | 1544704915
    61 | 2018-12-13 12:41:52 | 1544704912
    60 | 2018-12-13 12:41:48 | 1544704908
    59 | 2018-12-13 12:41:45 | 1544704905
    58 | 2018-12-13 12:41:42 | 1544704902
    57 | 2018-12-13 12:41:39 | 1544704899
    56 | 2018-12-13 12:41:36 | 1544704896
    55 | 2018-12-13 12:41:33 | 1544704893
    54 | 2018-12-13 12:41:30 | 1544704890
    53 | 2018-12-13 12:41:27 | 1544704887
    52 | 2018-12-13 12:41:24 | 1544704884

Done, I just increased the number being printed.