Skip to content

property lastblock on listsinceblock cannot be used on subsequent calls if target_confirmations exceeds current block count #19587

@ejose19

Description

@ejose19

When using listsinceblock with a target_confirmations greater than the current block count, it returns "0000000000000000000000000000000000000000000000000000000000000000" as lastblock, which makes the method fail when using that value as blockhash

Expected behavior

The method shouldn't throw an error for a return value that is supposed "to feed back into listsinceblock the next time you call it"

Actual behavior

RPC returns error code -5, "Block not found"

To reproduce
On a pristine node where "blocks" is currently at 0, call listsinceblock '' 6, it will return "0000000000000000000000000000000000000000000000000000000000000000" as lastblock, and on next call (listsinceblock "0000000000000000000000000000000000000000000000000000000000000000" 6 it will throw an error

System information

It can be reliable reproducible without any extra steps

Proposed solution
Returning the genesis block hash when target_confirmations exceeds the current block count

Note: This is particularly useful on regtest, as on mainnet you would need to call with "640645" (as of now) to get the described issue, but on a pristine regtest even using a value as low as 2 makes the returned value unsuitable for next calls.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions