Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Get block header fallback #587

Merged
merged 3 commits into from
Sep 4, 2019
Merged

Get block header fallback #587

merged 3 commits into from
Sep 4, 2019

Conversation

c0d3ster
Copy link
Contributor

Change Description

In response to #584

API Changes

  • API Changes
    The previous PR actually introduced the API changes, but the changes should be backwards compatible for any consumers of the API. This PR will add a fallback which will fix certain cases where get_block_header_state will fail

Documentation Additions

  • Documentation Additions

@c0d3ster c0d3ster changed the base branch from master to develop August 29, 2019 17:12
src/eosjs-api.ts Outdated

const taposBlockNumber = info.head_block_num - blocksBehind;
let refBlock: GetBlockHeaderStateResult | GetBlockResult;
if (taposBlockNumber - info.last_irreversible_block_num < 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a race condition. If this is false now, it may be true when nodeos processes the get_block_header_state request. If that fails, it needs to retry with get_block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll just wrap in a try/catch instead of trying to predict when this error will occur then.

@c0d3ster c0d3ster merged commit a53eecb into develop Sep 4, 2019
@c0d3ster c0d3ster deleted the get-block-header-fallback branch September 4, 2019 19:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants