Forgotten testnet1 cherries (#475)

* Very quick peer banning endpoint, helps with #406
* Ping heights (#407)
* add height to ping/ping
* reformat output
* fix p2p test
* Fix orphan handling, not related to current head. Fixes #412
* Check before borrow, fixes #267
* Not finding an output commit in pos is an AlreadySpent
* Fix race condition, sending before conn is ready
* Explicit error for unknown pos of a forked block
* Remove config outdated tests. Fix #333
* Check ref and try before borrow, fix #400
* We do not want to sync with old peers anyway
* Hide cargo compiler warning for unused NoopAdapter and unused test code. Add TODOs
This commit is contained in:
Simon B
2017-12-13 22:52:21 +01:00
committed by Ignotus Peverell
parent bffd955c26
commit 17d5898677
15 changed files with 126 additions and 73 deletions
+16 -2
View File
@@ -479,11 +479,14 @@ pub struct Ping {
/// total difficulty accumulated by the sender, used to check whether sync
/// may be needed
pub total_difficulty: Difficulty,
/// total height
pub height: u64,
}
impl Writeable for Ping {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ser::Error> {
self.total_difficulty.write(writer).unwrap();
self.height.write(writer).unwrap();
Ok(())
}
}
@@ -495,7 +498,11 @@ impl Readable for Ping {
Ok(diff) => diff,
Err(_) => Difficulty::zero(),
};
Ok(Ping { total_difficulty })
let height = match reader.read_u64(){
Ok(h) => h,
Err(_) => 0,
};
Ok(Ping { total_difficulty, height })
}
}
@@ -503,11 +510,14 @@ pub struct Pong {
/// total difficulty accumulated by the sender, used to check whether sync
/// may be needed
pub total_difficulty: Difficulty,
/// height accumulated by sender
pub height: u64
}
impl Writeable for Pong {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ser::Error> {
self.total_difficulty.write(writer).unwrap();
self.height.write(writer).unwrap();
Ok(())
}
}
@@ -519,6 +529,10 @@ impl Readable for Pong {
Ok(diff) => diff,
Err(_) => Difficulty::zero(),
};
Ok(Pong { total_difficulty })
let height = match reader.read_u64() {
Ok(h) => h,
Err(_) => 0,
};
Ok(Pong { total_difficulty, height })
}
}