Function filecoin_proofs_api::seal::generate_piece_commitment

source ·
pub fn generate_piece_commitment<T: Read>(
    registered_proof: RegisteredSealProof,
    source: T,
    piece_size: UnpaddedBytesAmount,
) -> Result<PieceInfo>
Expand description

Generates a piece commitment for the provided byte source. Returns an error if the byte source produced more than piece_size bytes.

§Arguments

  • registered_proof - Selected seal proof for this byte source.
  • source - A readable source of unprocessed piece bytes. The piece’s commitment will be generated for the bytes read from the source plus any added padding.
  • piece_size - The number of unpadded user-bytes which can be read from source before EOF.

Returns piece commitment in PieceInfo struct.