validate_operation

Function validate_operation 

Source
pub fn validate_operation<E>(
    operation: &Operation<E>,
) -> Result<(), OperationError>
where E: Extensions,
Expand description

Validate the header and body (when provided) of a single operation. All basic header validation is performed (identical to validate_header) and additionally the body bytes hash and size are checked to be correct.

This method validates that the following conditions are true:

  • Signature can be verified against the author public key and unsigned header bytes
  • Header version is supported (currently only version 1 is supported)
  • If payload_hash is set the payload_size is > 0 otherwise it is zero
  • If backlink is set then seq_num is > 0 otherwise it is zero
  • If provided the body bytes hash and size match those claimed in the header