fn single_transaction_block(oversized: bool) -> Block {
    // Dummy input and output
    let input =
        transparent::Input::zcash_deserialize(&zebra_test::vectors::DUMMY_INPUT1[..]).unwrap();
    let output =
        transparent::Output::zcash_deserialize(&zebra_test::vectors::DUMMY_OUTPUT1[..]).unwrap();

    // A block header
    let header = block_header();

    // Serialize header
    let mut data_header = Vec::new();
    header
        .zcash_serialize(&mut data_header)
        .expect("Block header should serialize");

    // Serialize a LockTime
    let lock_time = LockTime::Time(DateTime::<Utc>::from_utc(
        NaiveDateTime::from_timestamp(61, 0),
        Utc,
    ));
    let mut data_locktime = Vec::new();
    lock_time
        .zcash_serialize(&mut data_locktime)
        .expect("LockTime should serialize");

    // Calculate the number of inputs we need
    let mut max_inputs_in_tx = (MAX_BLOCK_BYTES as usize
        - data_header.len()
        - zebra_test::vectors::DUMMY_OUTPUT1[..].len()
        - data_locktime.len())
        / (zebra_test::vectors::DUMMY_INPUT1[..].len() - 1);

    if oversized {
        max_inputs_in_tx += 1;
    }

    let mut outputs = Vec::new();

    // Create inputs to be just below the limit
    let inputs = std::iter::repeat(input)
        .take(max_inputs_in_tx)
        .collect::<Vec<_>>();

    // 1 single output
    outputs.push(output);

    // Create a big transaction
    let big_transaction = Transaction::V1 {
        inputs,
        outputs,
        lock_time,
    };

    // Put the big transaction into a block
    let transactions = vec![Arc::new(big_transaction)];
    Block {
        header,
        transactions,
    }
}
// Implementation of block generation with one transaction and multiple inputs
Implementation of block generation with one transaction and multiple inputs
Implementation of block generation with one transaction and multiple inputs
fn single_transaction_block(oversized: bool) -> Block {
    // Dummy input and output
    let input =
        transparent::Input::zcash_deserialize(&zebra_test::vectors::DUMMY_INPUT1[..]).unwrap();
    let output =
        transparent::Output::zcash_deserialize(&zebra_test::vectors::DUMMY_OUTPUT1[..]).unwrap();
    // A block header
    let header = block_header();
    // Serialize header
    let mut data_header = Vec::new();
    header
        .zcash_serialize(&mut data_header)
        .expect("Block header should serialize");
    // Serialize a LockTime
    let lock_time = LockTime::Time(DateTime::<Utc>::from_utc(
        NaiveDateTime::from_timestamp(61, 0),
        Utc,
    ));
    let mut data_locktime = Vec::new();
    lock_time
        .zcash_serialize(&mut data_locktime)
        .expect("LockTime should serialize");
    // Calculate the number of inputs we need
    let mut max_inputs_in_tx = (MAX_BLOCK_BYTES as usize
        - data_header.len()
        - zebra_test::vectors::DUMMY_OUTPUT1[..].len()
        - data_locktime.len())
        / (zebra_test::vectors::DUMMY_INPUT1[..].len() - 1);
    if oversized {
        max_inputs_in_tx += 1;
    }
    let mut outputs = Vec::new();
    // Create inputs to be just below the limit
    let inputs = std::iter::repeat(input)
        .take(max_inputs_in_tx)
        .collect::<Vec<_>>();
    // 1 single output
    outputs.push(output);
    // Create a big transaction
    let big_transaction = Transaction::V1 {
        inputs,
        outputs,
        lock_time,
    };
    // Put the big transaction into a block
    let transactions = vec![Arc::new(big_transaction)];
    Block {
        header,
        transactions,
    }
}
fn single_transaction_block ( oversized : bool ) -> Block { // Dummy input and output let input = transparent :: Input :: zcash_deserialize ( & zebra_test :: vectors :: DUMMY_INPUT1 [ .. ] ) . unwrap ( ) ; let output = transparent :: Output :: zcash_deserialize ( & zebra_test :: vectors :: DUMMY_OUTPUT1 [ .. ] ) . unwrap ( ) ; // A block header let header = block_header ( ) ; // Serialize header let mut data_header = Vec :: new ( ) ; header . zcash_serialize ( & mut data_header ) . expect ( " " ) ; // Serialize a LockTime let lock_time = LockTime :: Time ( DateTime :: < Utc > :: from_utc ( NaiveDateTime :: from_timestamp ( 61 , 0 ) , Utc , ) ) ; let mut data_locktime = Vec :: new ( ) ; lock_time . zcash_serialize ( & mut data_locktime ) . expect ( " " ) ; // Calculate the number of inputs we need let mut max_inputs_in_tx = ( MAX_BLOCK_BYTES as usize - data_header . len ( ) - zebra_test :: vectors :: DUMMY_OUTPUT1 [ .. ] . len ( ) - data_locktime . len ( ) ) / ( zebra_test :: vectors :: DUMMY_INPUT1 [ .. ] . len ( ) - 1 ) ; if oversized { max_inputs_in_tx += 1 ; } let mut outputs = Vec :: new ( ) ; // Create inputs to be just below the limit let inputs = std :: iter :: repeat ( input ) . take ( max_inputs_in_tx ) . collect :: < Vec < _ > > ( ) ; // 1 single output outputs . push ( output ) ; // Create a big transaction let big_transaction = Transaction :: V1 { inputs , outputs , lock_time , } ; // Put the big transaction into a block let transactions = vec ! [ Arc new ( big_transaction ) ] ; Block { header , transactions , } }
Implementation of block generation with one transaction and multiple inputs
Implementation of block generation with one transaction and multiple inputs
oversized
bool