pub fn build_subtree_proof(
tree: &MerkleTree,
nonce: &[u8; 32],
challenged_peer_id: &[u8; 32],
bytes_for: impl Fn(&XorName) -> Option<Vec<u8>>,
) -> Result<SubtreeProof, BuildProofError>Expand description
Build the single-contiguous-subtree proof for (nonce, tree) (responder).
bytes_for(&key) returns the chunk bytes the responder holds for a key, or
None if it cannot read them. Walks the same nonce-selected path the
auditor will re-derive, reads the unselected sibling cut-hashes directly
from the committed tree (so they are provably consistent with the gossiped
root), and builds each selected leaf’s plain and nonced hashes from the real
bytes.
§Errors
See BuildProofError. MissingBytes is the one the caller penalises;
the others indicate an internal inconsistency.