dominant-strategies / go-quai

Official Go Implementation of the Quai Network
GNU General Public License v3.0
2.36k stars 456 forks source link

[RPC] - Encode if workshare is an uncle or not in getblockbynumber #1927

Open mibuono opened 2 days ago

mibuono commented 2 days ago

encoding it in the get block response is going to be the simplest for them, we save on the API calls as well, since its necessary information

Background:

Gameofpointers and I were going back and forth to determinethe best path forward for the blockscout team to be able to index work shares on getblockbynumber call. Initial thoughts were to provide an API call to calculate the proof of the work hash to return the value, so the difficulty of the block could be compared and thereby determine what is a work share and what is an uncle. An API was also proposed as a solution, but that might be cumbersome due to the amount of calls for each uncle/workshare that would need to be made.

We landed at encoding this in the hash itself to save on API calls.

mibuono commented 1 day ago

@gameofpointers from Blockscout:

Blockscout initiate it's indexing processing by calling quai_getBlockByNumber with ["latest", false] as param. When the latest block number is defined, it will start to query this same endpoint for every previous and new block, but this time using the block number as parameter.