Blockchain: get() method shall be refactored #12

Closed
opened 2 months ago by konrad · 1 comments
konrad commented 2 months ago
Owner

See here (chain/blockchain.ts):

//@FIXME the behaviour (either gte and lte OR limit) is crap
async get(limit: number = 0, gte: number = 0, lte: number = 0): Promise<Array<BlockStruct>>

This get() method is weird and difficult to test - it tries to cover several use cases in one single function. It might make lots of sense to split it into several methods, like getLastBlocks(limit: number) or ....

Then net/api.ts must be adapted to reflect the changes.

The explorer will also be affected.

See here (chain/blockchain.ts): ``` //@FIXME the behaviour (either gte and lte OR limit) is crap async get(limit: number = 0, gte: number = 0, lte: number = 0): Promise<Array<BlockStruct>> ``` This get() method is weird and difficult to test - it tries to cover several use cases in one single function. It might make lots of sense to split it into several methods, like getLastBlocks(limit: number) or .... Then net/api.ts must be adapted to reflect the changes. The explorer will also be affected.
Poster
Owner

Fixed

Fixed
konrad closed this issue 3 weeks ago
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.