More information in the updater.

This commit is contained in:
Gav Wood 2016-11-20 13:18:56 +01:00
parent 44eda379ad
commit 27a8608624
No known key found for this signature in database
GPG Key ID: C49C1ACA1CC9B252
2 changed files with 76 additions and 37 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
use std::sync::Weak;
use util::misc::code_hash;
use util::Address;
use util::{Address, H160};
use client::operations::Operations;
use client::client::Client;
@ -24,6 +24,10 @@ pub struct Updater {
operations: Operations,
}
fn platform() -> &'static str {
"linux_x64"
}
impl Updater {
pub fn new(client: Weak<Client>, operations: Address) -> Self {
Updater {
@ -32,13 +36,24 @@ impl Updater {
}
pub fn tick(&mut self) {
match self.operations.is_latest("par", &code_hash().into()) {
Ok(res) => {
info!("isLatest returned {}", res);
},
Err(e) => {
warn!(target: "dapps", "Error while calling Operations.isLatest: {:?}", e);
}
}
(|| -> Result<(), String> {
let code_hash = H160::from("0x080ec8043f41e25ee8aa4ee6112906ac6d82ea74").into();//code_hash().into();
let client = "parity";
let (fork, track, semver) = self.operations.find_release(client, &code_hash)?;
let track_name = match track { 1 => "stable", 2 => "beta", 3 => "nightly", _ => "unknown" };
info!(target: "updater", "Current release ({}) is {}.{}.{}-{} and latest fork it supports is at block #{}", H160::from(code_hash), semver >> 16, (semver >> 8) & 0xff, semver & 0xff, track_name, fork);
let latest_fork = self.operations.latest_fork()?;
info!(target: "updater", "Latest fork is at block #{}", latest_fork);
let latest = self.operations.latest_in_track(client, track)?;
let (fork, _, semver) = self.operations.find_release(client, &latest)?;
info!(target: "updater", "Latest release in our track is {}.{}.{}-{} ({:?}); supports fork at block #{}", semver >> 16, (semver >> 8) & 0xff, semver & 0xff, track_name, H160::from(latest), fork);
let exe_hash = self.operations.find_checksum(client, &latest, platform())?;
info!(target: "updater", "Latest release's binary on {} is {}", platform(), exe_hash);
Ok(())
})().unwrap_or_else(|e| warn!("{}", e));
}
}