[2.x.x] deserialization now protocol version aware (#2824)

* introduce protocol version to deserialize and read

* thread protocol version through our reader

* example protocol version access in kernel read

* fix our StreamingReader impl (WouldBlock woes)

* debug log progress of txhashset download
This commit is contained in:
Antioch Peverell
2019-06-27 17:19:41 +01:00
committed by GitHub
parent 9398578947
commit 5aaf2d058d
20 changed files with 207 additions and 114 deletions
+2 -1
View File
@@ -21,6 +21,7 @@ use std::time::SystemTime;
use crate::core::consensus::graph_weight;
use crate::core::core::hash::Hash;
use crate::core::ser::ProtocolVersion;
use chrono::prelude::*;
@@ -147,7 +148,7 @@ pub struct PeerStats {
/// Address
pub addr: String,
/// version running
pub version: p2p::msg::ProtocolVersion,
pub version: ProtocolVersion,
/// Peer user agent string.
pub user_agent: String,
/// difficulty reported by peer
+4 -3
View File
@@ -39,6 +39,7 @@ use crate::common::stats::{DiffBlock, DiffStats, PeerStats, ServerStateInfo, Ser
use crate::common::types::{Error, ServerConfig, StratumServerConfig, SyncState, SyncStatus};
use crate::core::core::hash::{Hashed, ZERO_HASH};
use crate::core::core::verifier_cache::{LruVerifierCache, VerifierCache};
use crate::core::ser::ProtocolVersion;
use crate::core::{consensus, genesis, global, pow};
use crate::grin::{dandelion_monitor, seed, sync};
use crate::mining::stratumserver;
@@ -414,9 +415,9 @@ impl Server {
self.chain.header_head().map_err(|e| e.into())
}
/// Current p2p layer protocol version.
pub fn protocol_version() -> p2p::msg::ProtocolVersion {
p2p::msg::ProtocolVersion::default()
/// The p2p layer protocol version for this node.
pub fn protocol_version() -> ProtocolVersion {
ProtocolVersion::default()
}
/// Returns a set of stats about this server. This and the ServerStats