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

issue ejose19 opened this issue on July 24, 2020
  1. ejose19 commented at 11:35 PM on July 24, 2020: none

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    <!-- Describe the issue -->

    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

    <!--- What behavior did you expect? -->

    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

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    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

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    System information

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

    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.

  2. ejose19 added the label Bug on Jul 24, 2020
  3. adaminsky referenced this in commit c879054f74 on Aug 2, 2020
  4. adaminsky commented at 8:31 AM on August 2, 2020: contributor

    Recent changes seem to have made this worse. On the most recent version of the code, I get a error code -1 instead of the previous -5 error code. None of the existing tests relied on the behavior of the zero block appearing after the genesis block, but I'm not sure if this has any other purpose.

  5. MarcoFalke added the label RPC/REST/ZMQ on Aug 2, 2020
  6. MarcoFalke added the label Wallet on Aug 2, 2020
  7. adaminsky referenced this in commit 19e5cd5717 on Aug 2, 2020
  8. adaminsky referenced this in commit 88ce8c9d3c on Aug 8, 2020
  9. laanwj referenced this in commit 6757b3ac8f on Aug 13, 2020
  10. adamjonas commented at 10:53 PM on January 4, 2021: member

    This was closed by #19655.

  11. ejose19 commented at 11:50 PM on January 4, 2021: none

    @adamjonas can confirm this is solved in v0.21.0, thanks @adaminsky for the PR!

  12. ejose19 closed this on Jan 4, 2021

  13. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me