Skip to content
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

[Fix] change get_blocks range to closed interval #3394

Closed
wants to merge 1 commit into from

Conversation

xG0Ian
Copy link

@xG0Ian xG0Ian commented Sep 5, 2024

Motivation

Close issue: #3387

We say GET /testnet/blocks?start={start_height}&end={end_height} Returns the blocks for the given block range ( api doc )

the given block range was not described clearly enough.

/testnet/blocks returns the blocks of from start_height to end_height - 1. But I think it should return from start_height to end_height with closed interval which is more friendly with human intuition, cuz we always use current block height as end_height, easily misunderstood if we need give it current block height + 1.

Test Plan

change

let blocks = cfg_into_iter!((start_height..end_height))

to

let blocks = cfg_into_iter!((start_height..=end_height)) 

@raychu86
Copy link
Contributor

raychu86 commented Sep 6, 2024

We are following the inclusive start and exclusive end standard that is present in many blockchain and non-blockchain APIs.

The API documentation could definitely be more clear, however changing this standard will have a lot of downstream effects. This seems like an innocent change, but will break explorers, wallets, services, etc.

@xG0Ian
Copy link
Author

xG0Ian commented Sep 7, 2024

got it, so we need to make the documentation clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants