Skip to content

fix(core-api): use blockHistoryService for first and last block retrieval#63

Merged
Cactus-15-49 merged 1 commit intodevelopfrom
fix/api-again
Apr 17, 2022
Merged

fix(core-api): use blockHistoryService for first and last block retrieval#63
Cactus-15-49 merged 1 commit intodevelopfrom
fix/api-again

Conversation

@alessiodf
Copy link
Collaborator

There is a bug in the upstream code for the Public API which means /api/blocks/last raises an Internal Server Error and dumps log spam if the last block in the blockchain contains any multipayments. It would also affect /api/blocks/first if the genesis block contained one or more multipayments.

This PR fixes the bug by calling the show method for first and last in the BlocksController so it now fetches the relevant block via the blockHistoryService instead of directly from the blockchain object. Another benefit of taking this approach is that now the blocks returned via first and last using ?transform=false are the same structure as when fetching blocks by height or id. For example, the responses from /api/blocks/first?transform=false and /api/blocks/1?transform=false were not identical. Now they are.

@alessiodf alessiodf requested a review from Cactus-15-49 as a code owner April 17, 2022 23:04
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