restored original test logic
This commit is contained in:
parent
6b45d453b8
commit
d0151d2b79
|
@ -757,7 +757,6 @@ mod bench {
|
||||||
// Create transactions between unrelated parties.
|
// Create transactions between unrelated parties.
|
||||||
let txs = 100_000;
|
let txs = 100_000;
|
||||||
let last_ids: Mutex<HashSet<Hash>> = Mutex::new(HashSet::new());
|
let last_ids: Mutex<HashSet<Hash>> = Mutex::new(HashSet::new());
|
||||||
let errors: Mutex<usize> = Mutex::new(0);
|
|
||||||
let transactions: Vec<_> = (0..txs)
|
let transactions: Vec<_> = (0..txs)
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
|
@ -775,16 +774,10 @@ mod bench {
|
||||||
// Seed the 'from' account.
|
// Seed the 'from' account.
|
||||||
let rando0 = KeyPair::new();
|
let rando0 = KeyPair::new();
|
||||||
let tr = Transaction::new(&mint.keypair(), rando0.pubkey(), 1_000, last_id);
|
let tr = Transaction::new(&mint.keypair(), rando0.pubkey(), 1_000, last_id);
|
||||||
// some of these will fail because balance updates before transaction completes
|
let _ = acc.process_verified_transaction(&tr);
|
||||||
match acc.process_verified_transaction(&tr) {
|
|
||||||
Ok(_) => (),
|
|
||||||
Err(_) => *errors.lock().unwrap() += 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
let rando1 = KeyPair::new();
|
let rando1 = KeyPair::new();
|
||||||
let tr = Transaction::new(&rando0, rando1.pubkey(), 2, last_id);
|
let tr = Transaction::new(&rando0, rando1.pubkey(), 2, last_id);
|
||||||
// these will fail if the prior transaction does not go through
|
|
||||||
// but won't typically fail otherwise since the addresses are randomly generated
|
|
||||||
let _ = acc.process_verified_transaction(&tr);
|
let _ = acc.process_verified_transaction(&tr);
|
||||||
|
|
||||||
// Finally, return a transaction that's unique
|
// Finally, return a transaction that's unique
|
||||||
|
@ -811,7 +804,7 @@ mod bench {
|
||||||
let entries: Vec<Entry> = skel.historian.receiver.iter().collect();
|
let entries: Vec<Entry> = skel.historian.receiver.iter().collect();
|
||||||
assert_eq!(entries.len(), 1);
|
assert_eq!(entries.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
entries[0].events.len() + *errors.lock().unwrap(),
|
entries[0].events.len(),
|
||||||
txs as usize
|
txs as usize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue