Check for duplicate signatures
TODO: have client add recent hash to each message
This commit is contained in:
@@ -11,9 +11,7 @@ fn main() {
|
||||
let socket = UdpSocket::bind(send_addr).unwrap();
|
||||
let mut acc = AccountantStub::new(addr, socket);
|
||||
let alice_keypair = generate_keypair();
|
||||
let bob_keypair = generate_keypair();
|
||||
let alice_pubkey = get_pubkey(&alice_keypair);
|
||||
let bob_pubkey = get_pubkey(&bob_keypair);
|
||||
let txs = 10_000;
|
||||
println!("Depositing {} units in Alice's account...", txs);
|
||||
let sig = acc.deposit(txs, &alice_keypair).unwrap();
|
||||
@@ -24,11 +22,10 @@ fn main() {
|
||||
println!("Transferring 1 unit {} times...", txs);
|
||||
let now = Instant::now();
|
||||
let mut sig = sig;
|
||||
for i in 0..txs {
|
||||
for _ in 0..txs {
|
||||
let bob_keypair = generate_keypair();
|
||||
let bob_pubkey = get_pubkey(&bob_keypair);
|
||||
sig = acc.transfer(1, &alice_keypair, bob_pubkey).unwrap();
|
||||
if i % 200 == 1 {
|
||||
acc.wait_on_signature(&sig).unwrap();
|
||||
}
|
||||
}
|
||||
println!("Waiting for last transaction to be confirmed...",);
|
||||
acc.wait_on_signature(&sig).unwrap();
|
||||
@@ -37,13 +34,7 @@ fn main() {
|
||||
let ns = duration.as_secs() * 1_000_000_000 + duration.subsec_nanos() as u64;
|
||||
let tps = (txs * 1_000_000_000) as f64 / ns as f64;
|
||||
println!("Done. {} tps!", tps);
|
||||
println!(
|
||||
"Alice's Final Balance {}",
|
||||
acc.get_balance(&alice_pubkey).unwrap()
|
||||
);
|
||||
|
||||
println!(
|
||||
"Bob's Final Balance {}",
|
||||
acc.get_balance(&bob_pubkey).unwrap()
|
||||
);
|
||||
let val = acc.get_balance(&alice_pubkey).unwrap();
|
||||
println!("Alice's Final Balance {}", val);
|
||||
assert_eq!(val, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user