// This function checks that the inputs exists in the UTXO set but do not exist in the STXO set.
This function checks that the inputs exists in the UTXO set but do not exist in the STXO set.
This function checks that the inputs exists in the UTXO set but do not exist in the STXO set .
fn verify_not_stxos<B: BlockchainBackend>(tx: &Transaction, db: &B) -> Result<(), ValidationError> {
    let deleted = db.fetch_deleted_bitmap()?;
    let mut not_found_input = Vec::new();
    for input in tx.body.inputs() {
        if let Some((_, index, _height)) = db.fetch_output(&input.output_hash())? {
            if deleted.bitmap().contains(index) {
                warn!(
                    target: LOG_TARGET,
                    "Transaction validation failed due to already spent input: {}", input
                );
                return Err(ValidationError::ContainsSTxO);
            }
        } else if !tx
            .body
            .outputs()
            .iter()
            .any(|output| output.hash() == input.output_hash())
        {
            warn!(
                target: LOG_TARGET,
                "Transaction uses input: {} which does not exist yet", input
            );
            not_found_input.push(input.output_hash());
        }
    }
    if !not_found_input.is_empty() {
        return Err(ValidationError::UnknownInputs(not_found_input));
    }
    Ok(())
}
fn verify_not_stxos < B : BlockchainBackend > ( tx : & Transaction , db : & B ) -> Result < ( ) , ValidationError > { let deleted = db . fetch_deleted_bitmap ( ) ? ; let mut not_found_input = Vec :: new ( ) ; for input in tx . body . inputs ( ) { if let Some ( ( _ , index , _height ) ) = db . fetch_output ( & input . output_hash ( ) ) ? { if deleted . bitmap ( ) . contains ( index ) { warn ! ( target LOG_TARGET " " input ) ; return Err ( ValidationError :: ContainsSTxO ) ; } } else if ! tx . body . outputs ( ) . iter ( ) . any ( | output | output . hash ( ) == input . output_hash ( ) ) { warn ! ( target LOG_TARGET " " input ) ; not_found_input . push ( input . output_hash ( ) ) ; } } if ! not_found_input . is_empty ( ) { return Err ( ValidationError :: UnknownInputs ( not_found_input ) ) ; } Ok ( ( ) ) }
This function checks that the inputs exists in the UTXO set but do not exist in the STXO set.
This function checks that the inputs exists in the UTXO set but do not exist in the STXO set .
tx
&Transaction
db
&B