Skip to content

Optimize batched RPC lookups in P2P branch #464

Description

@Pantamis

Batched RPC can be resolved faster in P2P branch.

Indeed, each RPC will require loading one block: the one at the height given by an index lookup. But several requests may require looking at the same block ! Currently, each RPC will load the block needed once no matter what.

An interesting improvement could be to first get all needed block heights for each RPC, sort the requests by block height and load a block only once even if it is required for several RPCs. Once loaded we search all the transactions we are looking for in it and send the responses in the order at which we find them.

This is very similar to what is done when loading blocks with scripthash status sync where several blocks are loaded but one block may contain several relevant transactions.

However I think this may require significant refactoring of the code....

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions