[2.x.x] Writeable protocol version aware (#2856)

* introduce protocol version to deserialize and read

* thread protocol version through our reader

* cleanup

* cleanup

* streaming_reader cleanup

* Pass protocol version into BinWriter to allow for version specific serialization rules.

* rustfmt

* read and write now protocol version specific
This commit is contained in:
Antioch Peverell
2019-07-06 15:51:03 +01:00
committed by GitHub
parent b6daf1edfd
commit d284d8f6de
24 changed files with 192 additions and 95 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ impl PoolPushHandler {
})
.and_then(move |tx_bin| {
// TODO - pass protocol version in via the api call?
let version = ProtocolVersion::default();
let version = ProtocolVersion::local();
ser::deserialize(&mut &tx_bin[..], version)
.map_err(|e| ErrorKind::RequestError(format!("Bad request: {}", e)).into())
+1 -1
View File
@@ -83,7 +83,7 @@ pub struct Status {
impl Status {
pub fn from_tip_and_peers(current_tip: chain::Tip, connections: u32) -> Status {
Status {
protocol_version: ser::ProtocolVersion::default().into(),
protocol_version: ser::ProtocolVersion::local().into(),
user_agent: p2p::msg::USER_AGENT.to_string(),
connections: connections,
tip: Tip::from_tip(current_tip),