Fix nightly
This commit is contained in:
parent
e4c47e8417
commit
0ee3ec86bd
|
@ -138,13 +138,13 @@ pub enum Response {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use accountant::Accountant;
|
use accountant::Accountant;
|
||||||
|
use accounting_stage::AccountingStage;
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use event::Event;
|
use event::Event;
|
||||||
use historian::Historian;
|
use historian::Historian;
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
use signature::{KeyPair, KeyPairUtil};
|
use signature::{KeyPair, KeyPairUtil};
|
||||||
use std::sync::mpsc::sync_channel;
|
use std::sync::mpsc::sync_channel;
|
||||||
use accounting_stage::AccountingStage;
|
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -193,21 +193,22 @@ mod bench {
|
||||||
extern crate test;
|
extern crate test;
|
||||||
use self::test::Bencher;
|
use self::test::Bencher;
|
||||||
use accountant::{Accountant, MAX_ENTRY_IDS};
|
use accountant::{Accountant, MAX_ENTRY_IDS};
|
||||||
|
use accounting_stage::*;
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use hash::hash;
|
use hash::hash;
|
||||||
|
use historian::Historian;
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
|
use rayon::prelude::*;
|
||||||
use signature::{KeyPair, KeyPairUtil};
|
use signature::{KeyPair, KeyPairUtil};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::mpsc::sync_channel;
|
use std::sync::mpsc::sync_channel;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use accounting_stage::*;
|
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn process_events_bench(_bencher: &mut Bencher) {
|
fn process_events_bench(_bencher: &mut Bencher) {
|
||||||
let mint = Mint::new(100_000_000);
|
let mint = Mint::new(100_000_000);
|
||||||
let acc = Accountant::new(&mint);
|
let acc = Accountant::new(&mint);
|
||||||
let rsp_addr: SocketAddr = "0.0.0.0:0".parse().expect("socket address");
|
|
||||||
// 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());
|
||||||
|
@ -239,24 +240,24 @@ mod bench {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let req_vers = transactions
|
let events: Vec<_> = transactions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tr| (Request::Transaction(tr), rsp_addr, 1_u8))
|
.map(|tr| Event::Transaction(tr))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let (input, event_receiver) = sync_channel(10);
|
let (input, event_receiver) = sync_channel(10);
|
||||||
let historian = Historian::new(event_receiver, &mint.last_id(), None);
|
let historian = Historian::new(event_receiver, &mint.last_id(), None);
|
||||||
let stage = AccountingStage::new(acc, input, historian);
|
let stage = AccountingStage::new(acc, input);
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
assert!(stage.process_events(req_vers).is_ok());
|
assert!(stage.process_events(events).is_ok());
|
||||||
let duration = now.elapsed();
|
let duration = now.elapsed();
|
||||||
let sec = duration.as_secs() as f64 + duration.subsec_nanos() as f64 / 1_000_000_000.0;
|
let sec = duration.as_secs() as f64 + duration.subsec_nanos() as f64 / 1_000_000_000.0;
|
||||||
let tps = txs as f64 / sec;
|
let tps = txs as f64 / sec;
|
||||||
|
|
||||||
// Ensure that all transactions were successfully logged.
|
// Ensure that all transactions were successfully logged.
|
||||||
drop(stage.historian_input);
|
drop(stage.historian_input);
|
||||||
let entries: Vec<Entry> = stage.historian.output.lock().unwrap().iter().collect();
|
let entries: Vec<Entry> = historian.output.lock().unwrap().iter().collect();
|
||||||
assert_eq!(entries.len(), 1);
|
assert_eq!(entries.len(), 1);
|
||||||
assert_eq!(entries[0].events.len(), txs as usize);
|
assert_eq!(entries[0].events.len(), txs as usize);
|
||||||
|
|
||||||
|
|
|
@ -130,11 +130,11 @@ pub fn ed25519_verify(batches: &Vec<SharedPackets>) -> Vec<Vec<u8>> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use accounting_stage::Request;
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use ecdsa;
|
use ecdsa;
|
||||||
use packet::{Packet, Packets, SharedPackets};
|
use packet::{Packet, Packets, SharedPackets};
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use accounting_stage::Request;
|
|
||||||
use transaction::test_tx;
|
use transaction::test_tx;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//! messages to the network directly. The binary encoding of its messages are
|
//! messages to the network directly. The binary encoding of its messages are
|
||||||
//! unstable and may change in future releases.
|
//! unstable and may change in future releases.
|
||||||
|
|
||||||
|
use accounting_stage::{Request, Response, Subscription};
|
||||||
use bincode::{deserialize, serialize};
|
use bincode::{deserialize, serialize};
|
||||||
use futures::future::{ok, FutureResult};
|
use futures::future::{ok, FutureResult};
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
|
@ -10,7 +11,6 @@ use signature::{KeyPair, PublicKey, Signature};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::net::{SocketAddr, UdpSocket};
|
use std::net::{SocketAddr, UdpSocket};
|
||||||
use accounting_stage::{Request, Response, Subscription};
|
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
pub struct ThinClient {
|
pub struct ThinClient {
|
||||||
|
|
Loading…
Reference in New Issue