Cleanup stratum a bit (#11161)

* Cleanup stratum a bit

Salvage some code from https://github.com/paritytech/parity-ethereum/pull/10884 + some cleanup and typos.

* HashSet::new does not allocate before first insert

* Remove unused method push_work()
This commit is contained in:
David
2019-10-11 11:52:09 +02:00
committed by GitHub
parent 4f25d43516
commit f3015ce0c6
3 changed files with 33 additions and 68 deletions

View File

@@ -225,8 +225,6 @@ impl NotifyWork for Stratum {
self.service.push_work_all(
self.dispatcher.payload(pow_hash, difficulty, number)
).unwrap_or_else(
|e| warn!(target: "stratum", "Error while pushing work: {:?}", e)
);
}
}
@@ -239,16 +237,13 @@ impl Stratum {
let dispatcher = Arc::new(StratumJobDispatcher::new(miner, client));
let stratum_svc = StratumService::start(
let service = StratumService::start(
&SocketAddr::new(options.listen_addr.parse::<IpAddr>()?, options.port),
dispatcher.clone(),
options.secret.clone(),
)?;
Ok(Stratum {
dispatcher: dispatcher,
service: stratum_svc,
})
Ok(Stratum { dispatcher, service })
}
/// Start STRATUM job dispatcher and register it in the miner