8000 Added /api/v1/blocks-extras endpoint by nymkappa · Pull Request #1235 · mempool/mempool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added /api/v1/blocks-extras endpoint #1235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 12, 2022
Merged

Added /api/v1/blocks-extras endpoint #1235

merged 6 commits into from
Feb 12, 2022

Conversation

nymkappa
Copy link
Member
@nymkappa nymkappa commented Feb 8, 2022

This PR adds two news endpoints /api/v1/blocks-extras and /api/v1/blocks-extras/:height. This endpoint is not yet used anywhere in the front end, and it does not replace any existing node backend endpoint.

This PR adds two new optional field to the ExtendedBlock interface. pool and coinbaseHex. Those fields are only available in the response if the network is bitcoin, testnet or signet AND config.database.enabled flag is set to true.

Before testing each scenarios make sure to set your schema_version to 4 in the database, delete your blocks db table content, and wipe the cache/ folder. Then restart the node backend.

Feel free to test other scenarios as well as I'm limited locally.

Therefore, three scenarios must be tested (curl localhost:4200/api/v1/blocks-extras | jq)

  • First scenario: config.database.enabled set to false
    • Should only return the following fields in the extras sub object, with possible zeroed values:
      • medianFee, feeRange, reward, coinbaseTx, matchRate
  • Second scenario: config.database.enabled set to true
    • Should return the following fields in the extras sub object, with possible zeroed values:
      • medianFee, feeRange, reward, coinbaseTx, matchRate, pool.name pool.id and coinbaseHex
  • Third scenario: Liquid or Bisq
    • Should behave like in the first scenario, but it's unclear is this new API will be used for non Bitcoin networks

Since new fields are added to the block data stucture, the cached blocks in the node backend are also impacted, therefore it is still possible that the front end may be impacted (it should not of course).
Things to double check are:

  • Blocks hyperlink and data in the dashboard
  • Arrow right/left action in the dashboard
  • Blocks hyperlink and data in the /blocks list page
  • Recent blocks detailed page in /block page

@nymkappa nymkappa requested review from wiz and softsimon February 8, 2022 06:44
@cla-bot cla-bot bot added the cla-signed label Feb 8, 2022
@nymkappa nymkappa changed the title Added /api/v1/blocksExtras endpoint Added /api/v1/blocks-extras endpoint Feb 8, 2022
@nymkappa
Copy link
Member Author
nymkappa commented Feb 10, 2022

I've rebased the branch on master because there was a conflict. Please git reset --hard 2f921f4cc73994cc9ea9c317c8897de0d1881340 ; git pull nymkappa feature/blocks-extras before testing again

@nymkappa
Copy link
Member Author

Quick benchmark regarding the block indexing process. It took 22961 seconds (~6 hours 22 minutes) to index all blocks and their coinbase transaction on my machine at an average of 31 blocks per seconds.

Benchmark hardware specs:

  • Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz (6144 KB cache)
  • 16GB memory
  • SSD drive

Copy link
Member
@softsimon softsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Member
@wiz wiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK @ v2.4.0-dev [ba36ab3]

@wiz wiz merged commit 039a627 into mempool:master Feb 12, 2022
@nymkappa nymkappa deleted the feature/blocks-extras branch February 17, 2022 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0