prunedheight seems incorrect #15147

issue NicolasDorier opened this issue on January 11, 2019
  1. NicolasDorier commented at 7:27 AM on January 11, 2019: contributor

    So we created a node, and used Fast Sync (UTXO set import) from block 551636 with 300 blocks before. Our getblockchaininfo gives us "pruneheight": 551556, which seem correct to me.

    root@vmi228582:~# bitcoin-cli.sh getblockchaininfo
    {
      "chain": "main",
      "blocks": 558042,
      "headers": 558042,
      "bestblockhash": "0000000000000000001f5d5353909f3337c236f0020779105badfe83b2e1daff",
      "difficulty": 5618595848853.279,
      "mediantime": 1547189577,
      "verificationprogress": 0.9999966983924853,
      "initialblockdownload": false,
      "chainwork": "000000000000000000000000000000000000000004ae862ebcd4312d54c4cf2f",
      "size_on_disk": 7161575004,
      "pruned": true,
      "pruneheight": 551556,
      "automatic_pruning": true,
      "prune_target_size": 104857600000,
      "softforks": [
        {
          "id": "bip34",
          "version": 2,
          "reject": {
            "status": true
          }
        },
        {
          "id": "bip66",
          "version": 3,
          "reject": {
            "status": true
          }
        },
        {
          "id": "bip65",
          "version": 4,
          "reject": {
            "status": true
          }
        }
      ],
      "bip9_softforks": {
        "csv": {
          "status": "active",
          "startTime": 1462060800,
          "timeout": 1493596800,
          "since": 419328
        },
        "segwit": {
          "status": "active",
          "startTime": 1479168000,
          "timeout": 1510704000,
          "since": 481824
        }
      },
      "warnings": ""
    }
    

    However blocks are still not found...

    root@vmi228582:~# bitcoin-cli.sh getblock 551636
    error code: -5
    error message:
    Block not found
    root@vmi228582:~# bitcoin-cli.sh getblock 551736
    error code: -5
    error message:
    Block not found
    

    This might be the root cause of https://github.com/ElementsProject/lightning/issues/2250

  2. NicolasDorier commented at 7:31 AM on January 11, 2019: contributor

    Mmmh actually even new blocks have this issue. Looking to it, might be some corruption.

    root@vmi228582:~# bitcoin-cli.sh getblock 558000
    error code: -5
    error message:
    Block not found
    
  3. NicolasDorier closed this on Jan 11, 2019

  4. NicolasDorier commented at 7:32 AM on January 11, 2019: contributor

    Facepalm... I was not passing the block hash.

  5. jnewbery commented at 3:21 PM on January 11, 2019: member

    Logging here:

    https://github.com/bitcoin/bitcoin/blob/b68bac83d9ead9e8893785a58fbed6d09cba4b5c/src/rpc/blockchain.cpp#L865

    could be improved to say "Block with hash %s not found."

  6. NicolasDorier commented at 9:30 AM on January 13, 2019: contributor

    @jnewbery better would be to validate that the input is indeed a hash.

  7. MarcoFalke commented at 7:23 PM on January 13, 2019: member

    This has been fixed in master by @Empact, see 5eb20f81d9568284dca735e4f770f41a48aa5660

  8. DrahtBot locked this on Dec 16, 2021

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-24 15:15 UTC

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