Skip to content

Resolve "Consensus API endpoint height and block hash do not match"

MERGE REQUEST

Overview

Fixes a race between the height of the current block and its hash in the /consensus endpoint. The reason being that we call cs.Height and cs.CurrentBlock which don't fetch both values under the same lock.

Changes to Work Flow

We now fetch the most recent height using cs.Height and the corresponding block using cs.BlockAtHeight to make sure we fetch the right block for a given height.

Testing Changes

Documentation Changes

N/A

Modules and Packages Impacted

node/api

Example for Visual changes (ie Screenshot)

N/A

Issues Closed

Closes #3661 (closed)

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • Pipeline Passing (this is for NDFs where tests were run in a loop)
  • All new methods, or updating methods have clear docstrings
  • Testing added or updated for new methods
  • API documentation updated for API updates
  • Module README.md updated for changes to work flow
  • Issue added to Sia-UI repo for new supporting features
Edited by Christopher Schinnerl

Merge request reports