Title: Get hash of oldest stored block (Core pruned mode)? Post by: jnano on June 10, 2018, 04:10:20 PM With Core in pruned mode, is there a command to get the hash of the oldest stored block?
Title: Re: Get hash of oldest stored block (Core pruned mode)? Post by: cellard on June 10, 2018, 05:48:17 PM With Core in pruned mode, is there a command to get the hash of the oldest stored block? I don't think so. It would be an interesting command to have. If there isn't, and until then, you can manually check it by subtracting N from current last block height, N being the number that you entered in the "prune=N" setting in your bitcoin.conf So do: getblockcount This will give you the latest block you have. For instance for me right now is 526788, so let's say your prune N value is 550 526788-550=526238 getblockhash 526238 And there you go. If you try to get the hash of a block that is behind N you should get an error, something like "block not available (pruned data)". A cvar that automates these steps could be added I guess. Title: Re: Get hash of oldest stored block (Core pruned mode)? Post by: achow101 on June 10, 2018, 07:58:30 PM getblockchaininfo will tell you the height of the oldest stored complete block. You can then look up its hash using getblockhash.
Title: Re: Get hash of oldest stored block (Core pruned mode)? Post by: jnano on June 10, 2018, 08:29:53 PM Thanks.
getblockchaininfo's pruneheight property is indeed it. cellard, that subtraction assumes each block is exactly 1MB, and that pruning keeps exactly the prune target in raw block data. |