Open vogelito opened 6 years ago
@vogelito I'm not sure why, I think it wasn't working..
Great... Thanks...
I believe the commented out code to be correct...
curl localhost:8732/chains/main/blocks/head/context/raw/json/rolls/owner/snapshot/42 --silent
[5]
((42-5-2)4096)+((5+1)256) = 144896 (which is what tzscan reports as the snapshot block index for cycle 42)
I validated a few other ones:
curl localhost:8732/chains/main/blocks/head/context/raw/json/rolls/owner/snapshot/37 --silent
[7]
((37-5-2)4096)+((7+1)256) = 124928 (also matches the snapshot block on tzscan)
The only problem is that the RPC calls takes a really long time (e.g. over 15 seconds sometimes):
$ time curl localhost:8732/chains/main/blocks/head/context/raw/json/rolls/owner/snapshot/39 --silent
[1]
real 0m17.320s
user 0m0.004s
sys 0m0.000s
I reported this bug on the tezos issue tracker for now: https://gitlab.com/tezos/tezos/issues/384
Moving back to your original code is definitely the right thing to do, but unfortunately it'll slow things down considerably. Any thoughts?
the getCycleSnapshot function currently uses the following to determine the block index of the snapshot at a given cycle:
https://github.com/dakk/tezpool/blob/847f855ff26246039bc1d477a99eaf3c7038a6a1/tezpool.py#L81 This is wrong. However, when looking into fixing it I noticed that just above that there's a commented bit that's a lot closer to what I'd expect would be correct: https://github.com/dakk/tezpool/blob/847f855ff26246039bc1d477a99eaf3c7038a6a1/tezpool.py#L76-L79
Before I started digging in more, I wanted to ask why are the bits commented out?