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:
@@ -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
|
||||
|
||||
@@ -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(()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user