Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

near: traverse block range via hashes #35

Closed
heyitaki opened this issue Dec 29, 2022 · 1 comment
Closed

near: traverse block range via hashes #35

heyitaki opened this issue Dec 29, 2022 · 1 comment
Assignees

Comments

@heyitaki
Copy link
Contributor

heyitaki commented Dec 29, 2022

As pointed out by @jumpsiegel and @tbjump, it's technically possible to retrieve the incorrect block from an RPC node when fetching by height since blocks are finalized once 66% of the network accepts them. Therefore, if we somehow hit a node with a different history, the same block height may point to a different (unfinalized!) block. In addition, NEAR sometimes has gaps of permanently unfinalized blocks, disallowing a naive iteration over blocks heights.

Since there is no way to check if a specific block is finalized or not by block height, a possible solution may be to grab the hash of the latest finalized block and walk backwards to fromBlock using the prev_hash field.

@heyitaki heyitaki mentioned this issue Dec 30, 2022
@heyitaki heyitaki self-assigned this Jan 2, 2023
@heyitaki
Copy link
Contributor Author

heyitaki commented Jan 9, 2023

Resolved by #34

@heyitaki heyitaki closed this as completed Jan 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant