fn mock_transparent_transaction(
    network: Network,
    block_height: block::Height,
    relative_source_heights: Vec<f64>,
    transaction_version: u8,
    lock_time: LockTime,
) -> (
    Transaction,
    HashMap<transparent::OutPoint, transparent::OrderedUtxo>,
) {
    let (transaction_version, network_upgrade) =
        sanitize_transaction_version(network, transaction_version, block_height);

    // Create fake transparent transfers that should succeed
    let (inputs, outputs, known_utxos) =
        mock_transparent_transfers(relative_source_heights, block_height);

    // Create the mock transaction
    let expiry_height = block_height;

    let transaction = match transaction_version {
        4 => Transaction::V4 {
            inputs,
            outputs,
            lock_time,
            expiry_height,
            joinsplit_data: None,
            sapling_shielded_data: None,
        },
        5 => Transaction::V5 {
            inputs,
            outputs,
            lock_time,
            expiry_height,
            sapling_shielded_data: None,
            orchard_shielded_data: None,
            network_upgrade,
        },
        invalid_version => unreachable!("invalid transaction version: {}", invalid_version),
    };

    (transaction, known_utxos)
}
/// Create a mock transaction that only transfers transparent amounts.
///
/// # Parameters
///
/// - `network`: the network to use for the transaction (mainnet or testnet)
/// - `block_height`: the block height to be used for the transaction's expiry height as well as
///   the height that the transaction was (hypothetically) included in a block
/// - `relative_source_heights`: a list of values in the range `0.0..1.0`; each item results in the
///   creation of a transparent input and output, where the item itself represents a scaled value
///   to be converted into a block height between zero and `block_height` (see
///   [`scale_block_height`] for details) to serve as the block height that created the input UTXO
/// - `transaction_version`: a value that's either `4` or `5` indicating the transaction version to
///   be generated; this value is sanitized by [`sanitize_transaction_version`], so it may not be
///   able to create a V5 transaction if the `block_height` is before the NU5 activation height
/// - `lock_time`: the transaction lock time to be used (note that all transparent inputs have a
///   sequence number of `0`, so the lock time is enabled by default)
///
/// # Panics
///
/// - if `transaction_version` is not `4` or `5` (the only transaction versions that are currently
/// supported by the transaction verifier)
/// - if `relative_source_heights` has more than `u32::MAX` items (see
/// [`mock_transparent_transfers`] for details)
/// - if any item of `relative_source_heights` is not in the range `0.0..1.0` (see
/// [`scale_block_height`] for details)
Create a mock transaction that only transfers transparent amounts.
Create a mock transaction that only transfers transparent amounts .
fn mock_transparent_transaction(
    network: Network,
    block_height: block::Height,
    relative_source_heights: Vec<f64>,
    transaction_version: u8,
    lock_time: LockTime,
) -> (
    Transaction,
    HashMap<transparent::OutPoint, transparent::OrderedUtxo>,
) {
    let (transaction_version, network_upgrade) =
        sanitize_transaction_version(network, transaction_version, block_height);
    // Create fake transparent transfers that should succeed
    let (inputs, outputs, known_utxos) =
        mock_transparent_transfers(relative_source_heights, block_height);
    // Create the mock transaction
    let expiry_height = block_height;
    let transaction = match transaction_version {
        4 => Transaction::V4 {
            inputs,
            outputs,
            lock_time,
            expiry_height,
            joinsplit_data: None,
            sapling_shielded_data: None,
        },
        5 => Transaction::V5 {
            inputs,
            outputs,
            lock_time,
            expiry_height,
            sapling_shielded_data: None,
            orchard_shielded_data: None,
            network_upgrade,
        },
        invalid_version => unreachable!("invalid transaction version: {}", invalid_version),
    };
    (transaction, known_utxos)
}
fn mock_transparent_transaction ( network : Network , block_height : block :: Height , relative_source_heights : Vec < f64 > , transaction_version : u8 , lock_time : LockTime , ) -> ( Transaction , HashMap < transparent :: OutPoint , transparent :: OrderedUtxo > , ) { let ( transaction_version , network_upgrade ) = sanitize_transaction_version ( network , transaction_version , block_height ) ; // Create fake transparent transfers that should succeed let ( inputs , outputs , known_utxos ) = mock_transparent_transfers ( relative_source_heights , block_height ) ; // Create the mock transaction let expiry_height = block_height ; let transaction = match transaction_version { 4 => Transaction :: V4 { inputs , outputs , lock_time , expiry_height , joinsplit_data : None , sapling_shielded_data : None , } , 5 => Transaction :: V5 { inputs , outputs , lock_time , expiry_height , sapling_shielded_data : None , orchard_shielded_data : None , network_upgrade , } , invalid_version => unreachable ! ( " " invalid_version ) , } ; ( transaction , known_utxos ) }
Create a mock transaction that only transfers transparent amounts.
Create a mock transaction that only transfers transparent amounts .
network
Network
the network to use for the transaction (mainnet or testnet)
the network to use for the transaction ( mainnet or testnet )
block_height
block::Height
the block height to be used for the transaction's expiry height as well as
the height that the transaction was (hypothetically) included in a block
the block height to be used for the transaction ' s expiry height as well as the height that the transaction was ( hypothetically ) included in a block
relative_source_heights
Vec<f64>
a list of values in the range `0.0..1.0`; each item results in the
creation of a transparent input and output, where the item itself represents a scaled value
to be converted into a block height between zero and `block_height` (see
[`scale_block_height`] for details) to serve as the block height that created the input UTXO
a list of values in the range ` 0 . 0 .. 1 . 0 ` ; each item results in the creation of a transparent input and output where the item itself represents a scaled value to be converted into a block height between zero and ` block_height ` ( see [ ` scale_block_height ` ] for details ) to serve as the block height that created the input UTXO
transaction_version
u8
a value that's either `4` or `5` indicating the transaction version to
be generated; this value is sanitized by [`sanitize_transaction_version`], so it may not be
able to create a V5 transaction if the `block_height` is before the NU5 activation height
a value that ' s either ` 4 ` or ` 5 ` indicating the transaction version to be generated ; this value is sanitized by [ ` sanitize_transaction_version ` ] so it may not be able to create a V5 transaction if the ` block_height ` is before the NU5 activation height
lock_time
LockTime
the transaction lock time to be used (note that all transparent inputs have a
sequence number of `0`, so the lock time is enabled by default)
the transaction lock time to be used ( note that all transparent inputs have a sequence number of ` 0 ` so the lock time is enabled by default )
panics
if `transaction_version` is not `4` or `5` (the only transaction versions that are currently
supported by the transaction verifier)
if `relative_source_heights` has more than `u32::MAX` items (see
[`mock_transparent_transfers`] for details)
if any item of `relative_source_heights` is not in the range `0.0..1.0` (see
[`scale_block_height`] for details)
if ` transaction_version ` is not ` 4 ` or ` 5 ` ( the only transaction versions that are currently supported by the transaction verifier ) if ` relative_source_heights ` has more than ` u32 :: MAX ` items ( see [ ` mock_transparent_transfers ` ] for details ) if any item of ` relative_source_heights ` is not in the range ` 0 . 0 .. 1 . 0 ` ( see [ ` scale_block_height ` ] for details )