fn validate_kernel_response(
        &self,
        kernel_hashes: &[HashOutput],
        kernels: &[TransactionKernel],
    ) -> Result<(), HorizonSyncError>
    {
        if kernels.is_empty() {
            return Err(HorizonSyncError::EmptyResponse);
        }
        // Check if the correct number of kernels returned
        if kernel_hashes.len() != kernels.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }

        // Check that kernel set is the requested kernels
        if kernel_hashes
            .iter()
            .enumerate()
            .any(|(i, kernel_hash)| &kernels[i].hash() != kernel_hash)
        {
            return Err(HorizonSyncError::IncorrectResponse);
        }

        for k in kernels {
            k.verify_signature().map_err(HorizonSyncError::InvalidKernelSignature)?;
        }

        Ok(())
    }
// Check the received set of kernels.
Check the received set of kernels.
Check the received set of kernels .
fn validate_kernel_response(
        &self,
        kernel_hashes: &[HashOutput],
        kernels: &[TransactionKernel],
    ) -> Result<(), HorizonSyncError>
    {
        if kernels.is_empty() {
            return Err(HorizonSyncError::EmptyResponse);
        }
        // Check if the correct number of kernels returned
        if kernel_hashes.len() != kernels.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        // Check that kernel set is the requested kernels
        if kernel_hashes
            .iter()
            .enumerate()
            .any(|(i, kernel_hash)| &kernels[i].hash() != kernel_hash)
        {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        for k in kernels {
            k.verify_signature().map_err(HorizonSyncError::InvalidKernelSignature)?;
        }
        Ok(())
    }
fn validate_kernel_response ( & self , kernel_hashes : & [ HashOutput ] , kernels : & [ TransactionKernel ] , ) -> Result < ( ) , HorizonSyncError > { if kernels . is_empty ( ) { return Err ( HorizonSyncError :: EmptyResponse ) ; } // Check if the correct number of kernels returned if kernel_hashes . len ( ) != kernels . len ( ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } // Check that kernel set is the requested kernels if kernel_hashes . iter ( ) . enumerate ( ) . any ( | ( i , kernel_hash ) | & kernels [ i ] . hash ( ) != kernel_hash ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } for k in kernels { k . verify_signature ( ) . map_err ( HorizonSyncError :: InvalidKernelSignature ) ? ; } Ok ( ( ) ) }
Check the received set of kernels.
Check the received set of kernels .
&self
kernel_hashes
&[HashOutput]
kernels
&[TransactionKernel]
&self
kernel_hashes
&[HashOutput]
kernels
&[TransactionKernel]