Skip to content

Pagination of long transaction list responses #348

@colatkinson

Description

@colatkinson

Currently, if the server generates an extremely long response, it simply returns an error message, such as

{ message: 'response too large (at least 1021611 bytes)', code: -32600 }

If the client receives this message, it will just hang indefinitely while attempting to sync.

Proposed Solution

Implement pagination in relevant methods, using block heights as a range. This has a couple advantages:

  1. Allow handling of very active addresses
  2. During sync, allow clients to only fetch transactions after where they left off, instead of fetching the entirety of their history. Same goes for getting tx inputs. This could conceivably lead to issues with a reorg, but the client could just fetch transactions starting from last height - n where n is e.g. 6

Affected RPC Methods

  • blockchain.address.get_history
  • blockchain.address.get_mempool
  • blockchain.address.listunspent
  • blockchain.scripthash.get_history
  • blockchain.scripthash.listunspent

It seems to me like the simplest solution would be to bump the protocol version number, and add optional pagination parameters to each of these methods. The version bump would allow clients to detect support for this, and thus be able to opt to get only the new txs during sync.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions