Skip to content

Implement Client::get_prune_height #40

@luisschwab

Description

@luisschwab

Implement a Client::get_blockchain_info, or Client::get_prune_height that queries the bitcoind backend about the prune height. This lets the wallet know whether it can do a full-scan when the backend is pruned.

This will go in tandem with the Wallet Birthday PR: if the birthday is older than the prune height, it cannot do a conclusive full-scan.

This info can be processed from bitcoin-cli getblockchaininfo's pruned and pruneheight fields:

% bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 935810,
  "headers": 935810,
  "bestblockhash": "00000000000000000000770db1b26286178ed24a5896140204e555d60cba8659",
  "bits": "17023c7e",
  "target": "000000000000000000023c7e0000000000000000000000000000000000000000",
  "difficulty": 125864590119494.3,
  "time": 1770673620,
  "mediantime": 1770669693,
  "verificationprogress": 0.9805905826175929,
  "initialblockdownload": true,
  "chainwork": "00000000000000000000000000000000000000010ddf1d907ae41ee34e5bc9aa",
  "size_on_disk": 5099746872,
+ "pruned": true,
+ "pruneheight": 933119,
  "automatic_pruning": true,
  "prune_target_size": 5242880000,
  "warnings": [
  ]
}

Then Client::get_prune_height can return an Option<u32>.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions