Move `v5_tx_with_no_outputs_fails_validation` test

This commit is contained in:
Marek 2024-12-20 13:34:39 +01:00
parent 61085712f6
commit 6c17f8de28
1 changed files with 27 additions and 27 deletions

View File

@ -172,6 +172,33 @@ fn v5_transaction_with_no_inputs_fails_validation() {
);
}
#[test]
fn v5_transaction_with_no_outputs_fails_verification() {
let (input, _, _) = mock_transparent_transfer(
Height(1),
true,
0,
Amount::try_from(1).expect("valid value"),
);
for net in Network::iter() {
let transaction = Transaction::V5 {
inputs: vec![input.clone()],
outputs: vec![],
lock_time: LockTime::Height(block::Height(0)),
expiry_height: NetworkUpgrade::Nu5.activation_height(&net).expect("height"),
sapling_shielded_data: None,
orchard_shielded_data: None,
network_upgrade: NetworkUpgrade::Nu5,
};
assert_eq!(
check::has_inputs_and_outputs(&transaction),
Err(TransactionError::NoOutputs)
);
}
}
#[tokio::test]
async fn mempool_request_with_missing_input_is_rejected() {
let mut state: MockService<_, _, _, _> = MockService::build().for_prop_tests();
@ -901,33 +928,6 @@ async fn state_error_converted_correctly() {
);
}
#[test]
fn v5_transaction_with_no_outputs_fails_validation() {
let (input, _, _) = mock_transparent_transfer(
Height(1),
true,
0,
Amount::try_from(1).expect("valid value"),
);
for net in Network::iter() {
let transaction = Transaction::V5 {
inputs: vec![input.clone()],
outputs: vec![],
lock_time: LockTime::Height(block::Height(0)),
expiry_height: NetworkUpgrade::Nu5.activation_height(&net).expect("height"),
sapling_shielded_data: None,
orchard_shielded_data: None,
network_upgrade: NetworkUpgrade::Nu5,
};
assert_eq!(
check::has_inputs_and_outputs(&transaction),
Err(TransactionError::NoOutputs)
);
}
}
#[test]
fn v5_coinbase_transaction_without_enable_spends_flag_passes_validation() {
let mut transaction = v5_transactions(zebra_test::vectors::MAINNET_BLOCKS.iter())