fn validate_utxo_and_rangeproof_response(
        &self,
        utxo_hashes: &[HashOutput],
        rp_hashes: &[HashOutput],
        request_utxo_hashes: &[&HashOutput],
        request_rp_hashes: &[&HashOutput],
        utxos: &[TransactionOutput],
    ) -> Result<(), HorizonSyncError>
    {
        // Check if the same number of utxo and rp MMR nodes returned
        if utxo_hashes.len() != rp_hashes.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        // Check that the correct number of utxos returned
        if request_utxo_hashes.len() != utxos.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }

        // Check that utxo set is the requested utxos
        if (0..request_utxo_hashes.len()).any(|i| &utxos[i].hash() != request_utxo_hashes[i]) {
            return Err(HorizonSyncError::IncorrectResponse);
        }

        // Check that utxo set matches the provided RangeProof MMR Nodes
        if (0..request_rp_hashes.len()).any(|i| &utxos[i].proof.hash() != request_rp_hashes[i]) {
            return Err(HorizonSyncError::IncorrectResponse);
        }

        Ok(())
    }
// Validate the received UTXO set and, UTXO and RangeProofs MMR nodes.
Validate the received UTXO set and, UTXO and RangeProofs MMR nodes.
Validate the received UTXO set and UTXO and RangeProofs MMR nodes .
fn validate_utxo_and_rangeproof_response(
        &self,
        utxo_hashes: &[HashOutput],
        rp_hashes: &[HashOutput],
        request_utxo_hashes: &[&HashOutput],
        request_rp_hashes: &[&HashOutput],
        utxos: &[TransactionOutput],
    ) -> Result<(), HorizonSyncError>
    {
        // Check if the same number of utxo and rp MMR nodes returned
        if utxo_hashes.len() != rp_hashes.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        // Check that the correct number of utxos returned
        if request_utxo_hashes.len() != utxos.len() {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        // Check that utxo set is the requested utxos
        if (0..request_utxo_hashes.len()).any(|i| &utxos[i].hash() != request_utxo_hashes[i]) {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        // Check that utxo set matches the provided RangeProof MMR Nodes
        if (0..request_rp_hashes.len()).any(|i| &utxos[i].proof.hash() != request_rp_hashes[i]) {
            return Err(HorizonSyncError::IncorrectResponse);
        }
        Ok(())
    }
fn validate_utxo_and_rangeproof_response ( & self , utxo_hashes : & [ HashOutput ] , rp_hashes : & [ HashOutput ] , request_utxo_hashes : & [ & HashOutput ] , request_rp_hashes : & [ & HashOutput ] , utxos : & [ TransactionOutput ] , ) -> Result < ( ) , HorizonSyncError > { // Check if the same number of utxo and rp MMR nodes returned if utxo_hashes . len ( ) != rp_hashes . len ( ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } // Check that the correct number of utxos returned if request_utxo_hashes . len ( ) != utxos . len ( ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } // Check that utxo set is the requested utxos if ( 0 .. request_utxo_hashes . len ( ) ) . any ( | i | & utxos [ i ] . hash ( ) != request_utxo_hashes [ i ] ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } // Check that utxo set matches the provided RangeProof MMR Nodes if ( 0 .. request_rp_hashes . len ( ) ) . any ( | i | & utxos [ i ] . proof . hash ( ) != request_rp_hashes [ i ] ) { return Err ( HorizonSyncError :: IncorrectResponse ) ; } Ok ( ( ) ) }
Validate the received UTXO set and, UTXO and RangeProofs MMR nodes.
Validate the received UTXO set and UTXO and RangeProofs MMR nodes .
&self
utxo_hashes
&[HashOutput]
rp_hashes
&[HashOutput]
request_utxo_hashes
&[&HashOutput]
request_rp_hashes
&[&HashOutput]
utxos
&[TransactionOutput]
&self
utxo_hashes
&[HashOutput]
rp_hashes
&[HashOutput]
request_utxo_hashes
&[&HashOutput]
request_rp_hashes
&[&HashOutput]
utxos
&[TransactionOutput]