Backports for beta (#1888)

* Sync to peers with confirmed fork block only (#1863)

* Fixing gas conversion

* Validating u256->usize conversion

* Update cache usage on commiting block info (#1871)

* Use UntrustedRlp for block verification (#1872)

* take snapshot at specified block and slightly better informants (#1873)

* prettier informant for snapshot creation

* allow taking snapshot at a given block

* minor tweaks

* elaborate on cli

* Send new block hashes to all peers (#1875)

* Reduce max open files (#1876)

* ws-rs update

* Fixing test

* Fixing miner deadlock (#1885)
This commit is contained in:
Arkadiy Paronyan
2016-08-09 14:05:02 +02:00
committed by GitHub
parent 6336bdecf3
commit 52ac5a00f5
22 changed files with 360 additions and 145 deletions

View File

@@ -46,7 +46,7 @@ impl TimeProvider for DefaultTimeProvider {
}
/// No of seconds the hash is valid
const TIME_THRESHOLD: u64 = 2;
const TIME_THRESHOLD: u64 = 7;
const TOKEN_LENGTH: usize = 16;
/// Manages authorization codes for `SignerUIs`
@@ -102,7 +102,7 @@ impl<T: TimeProvider> AuthCodes<T> {
let now = self.now.now();
// check time
if time >= now + TIME_THRESHOLD || time <= now - TIME_THRESHOLD {
warn!(target: "signer", "Received old authentication request.");
warn!(target: "signer", "Received old authentication request. ({} vs {})", now, time);
return false;
}
@@ -169,8 +169,8 @@ mod tests {
fn should_return_false_if_hash_is_valid_but_time_is_invalid() {
// given
let code = "23521352asdfasdfadf";
let time = 105;
let time2 = 95;
let time = 107;
let time2 = 93;
let codes = AuthCodes::new(vec![code.into()], || 100);
// when

View File

@@ -146,7 +146,9 @@ impl ws::Handler for Session {
fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
let req = try!(msg.as_text());
match self.handler.handle_request(req) {
Some(res) => self.out.send(res),
Some(res) => {
self.out.send(res)
},
None => Ok(()),
}
}