commit
19e3adce86
|
@ -31,7 +31,6 @@ rustc-serialize = "0.3"
|
|||
secp256k1 = "0.5"
|
||||
serde = "0.6"
|
||||
strason = "0.3"
|
||||
time = "0.1"
|
||||
|
||||
[dependencies.jsonrpc]
|
||||
version = "0.7" # for serde macros
|
||||
|
|
|
@ -52,7 +52,6 @@ extern crate secp256k1;
|
|||
extern crate serde;
|
||||
extern crate strason;
|
||||
#[cfg(all(test, feature = "unstable"))] extern crate test;
|
||||
extern crate time;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
//! This module provides support for low-level network communication.
|
||||
//!
|
||||
|
||||
use time::now;
|
||||
use std::time::{UNIX_EPOCH, SystemTime};
|
||||
use rand::{thread_rng, Rng};
|
||||
use std::io::{self, Write};
|
||||
use std::net;
|
||||
|
@ -146,7 +146,10 @@ impl Socket {
|
|||
pub fn version_message(&mut self, start_height: i32) -> Result<NetworkMessage, util::Error> {
|
||||
let recv_addr = try!(self.receiver_address());
|
||||
let send_addr = try!(self.sender_address());
|
||||
let timestamp = now().to_timespec().sec;
|
||||
let timestamp = match SystemTime::now().duration_since(UNIX_EPOCH) {
|
||||
Ok(dur) => dur,
|
||||
Err(err) => err.duration(),
|
||||
}.as_secs() as i64;
|
||||
|
||||
Ok(Version(VersionMessage {
|
||||
version: constants::PROTOCOL_VERSION,
|
||||
|
|
Loading…
Reference in New Issue