Push generated transactions together in a batch.
This commit is contained in:
parent
e358806491
commit
41298be329
|
@ -396,7 +396,7 @@ impl<T: Contribution> Hydrabadger<T> {
|
||||||
/// messages.
|
/// messages.
|
||||||
fn generate_txns_status(
|
fn generate_txns_status(
|
||||||
self,
|
self,
|
||||||
gen_txns: Option<fn(usize, usize) -> Vec<T>>,
|
gen_txns: Option<fn(usize, usize) -> T>,
|
||||||
) -> impl Future<Item = (), Error = ()> {
|
) -> impl Future<Item = (), Error = ()> {
|
||||||
Interval::new(
|
Interval::new(
|
||||||
Instant::now(),
|
Instant::now(),
|
||||||
|
@ -443,14 +443,12 @@ impl<T: Contribution> Hydrabadger<T> {
|
||||||
self.inner.config.txn_gen_bytes,
|
self.inner.config.txn_gen_bytes,
|
||||||
);
|
);
|
||||||
|
|
||||||
for txn in txns {
|
|
||||||
hdb.send_internal(InternalMessage::hb_input(
|
hdb.send_internal(InternalMessage::hb_input(
|
||||||
hdb.inner.uid,
|
hdb.inner.uid,
|
||||||
OutAddr(*hdb.inner.addr),
|
OutAddr(*hdb.inner.addr),
|
||||||
DhbInput::User(txn),
|
DhbInput::User(txns),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -464,7 +462,7 @@ impl<T: Contribution> Hydrabadger<T> {
|
||||||
pub fn node(
|
pub fn node(
|
||||||
self,
|
self,
|
||||||
remotes: Option<HashSet<SocketAddr>>,
|
remotes: Option<HashSet<SocketAddr>>,
|
||||||
gen_txns: Option<fn(usize, usize) -> Vec<T>>,
|
gen_txns: Option<fn(usize, usize) -> T>,
|
||||||
) -> impl Future<Item = (), Error = ()> {
|
) -> impl Future<Item = (), Error = ()> {
|
||||||
let socket = TcpListener::bind(&self.inner.addr).unwrap();
|
let socket = TcpListener::bind(&self.inner.addr).unwrap();
|
||||||
info!("Listening on: {}", self.inner.addr);
|
info!("Listening on: {}", self.inner.addr);
|
||||||
|
@ -507,7 +505,7 @@ impl<T: Contribution> Hydrabadger<T> {
|
||||||
pub fn run_node(
|
pub fn run_node(
|
||||||
self,
|
self,
|
||||||
remotes: Option<HashSet<SocketAddr>>,
|
remotes: Option<HashSet<SocketAddr>>,
|
||||||
gen_txns: Option<fn(usize, usize) -> Vec<T>>,
|
gen_txns: Option<fn(usize, usize) -> T>,
|
||||||
) {
|
) {
|
||||||
tokio::run(self.node(remotes, gen_txns));
|
tokio::run(self.node(remotes, gen_txns));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue