Fix `v5_transaction_is_rejected_before_nu5` test
This commit is contained in:
parent
d3f28b2068
commit
1f153889d8
|
@ -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))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue