mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-10 21:19:24 +00:00
Extensively test transactions
This commit is contained in:
18
coordinator/tributary/src/tests/transaction/provided.rs
Normal file
18
coordinator/tributary/src/tests/transaction/provided.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::collections::{HashSet, HashMap};
|
||||
|
||||
use rand_core::OsRng;
|
||||
|
||||
use crate::{Transaction, verify_transaction, tests::random_provided_transaction};
|
||||
|
||||
#[test]
|
||||
fn provided_transaction() {
|
||||
let tx = random_provided_transaction(&mut OsRng);
|
||||
|
||||
// Make sure this works when provided
|
||||
let mut provided = HashSet::from([tx.hash()]);
|
||||
verify_transaction(&tx, [0x88; 32], &mut provided, &mut HashMap::new()).unwrap();
|
||||
assert_eq!(provided.len(), 0);
|
||||
|
||||
// Make sure this fails when not provided
|
||||
assert!(verify_transaction(&tx, [0x88; 32], &mut HashSet::new(), &mut HashMap::new()).is_err());
|
||||
}
|
||||
Reference in New Issue
Block a user