Fix `v5_transaction_is_rejected_before_nu5` test

This commit is contained in:
Marek 2024-12-20 13:07:42 +01:00
parent d3f28b2068
commit 1f153889d8
1 changed files with 14 additions and 25 deletions

View File

@ -952,35 +952,24 @@ fn v5_coinbase_transaction_with_enable_spends_flag_fails_validation() {
#[tokio::test] #[tokio::test]
async fn v5_transaction_is_rejected_before_nu5_activation() { async fn v5_transaction_is_rejected_before_nu5_activation() {
const V5_TRANSACTION_VERSION: u32 = 5;
let canopy = NetworkUpgrade::Canopy; let canopy = NetworkUpgrade::Canopy;
for network in Network::iter() { for net in Network::iter() {
let state_service = service_fn(|_| async { unreachable!("Service should not be called") }); let verifier = Verifier::new_for_tests(
let verifier = Verifier::new_for_tests(&network, state_service); &net,
service_fn(|_| async { unreachable!("Service should not be called") }),
let transaction = v5_transactions(network.block_iter()) );
.next_back()
.expect("At least one fake V5 transaction in the test vectors");
let result = verifier
.oneshot(Request::Block {
transaction: Arc::new(transaction),
known_utxos: Arc::new(HashMap::new()),
height: canopy
.activation_height(&network)
.expect("Canopy activation height is specified"),
time: DateTime::<Utc>::MAX_UTC,
})
.await;
assert_eq!( assert_eq!(
result, verifier
Err(TransactionError::UnsupportedByNetworkUpgrade( .oneshot(Request::Block {
V5_TRANSACTION_VERSION, transaction: Arc::new(v5_transactions(net.block_iter()).next().expect("V5 tx")),
canopy known_utxos: Arc::new(HashMap::new()),
)) height: canopy.activation_height(&net).expect("height"),
time: DateTime::<Utc>::MAX_UTC,
})
.await,
Err(TransactionError::UnsupportedByNetworkUpgrade(5, canopy))
); );
} }
} }