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
+6 -3
View File
@@ -135,7 +135,7 @@ pub trait Protocol {
-> Box<Future<Item = (), Error = Error>>;
/// Sends a ping message to the remote peer.
fn send_ping(&self, total_difficulty: Difficulty) -> Result<(), Error>;
fn send_ping(&self, total_difficulty: Difficulty, height: u64) -> Result<(), Error>;
/// Relays a block to the remote peer.
fn send_block(&self, b: &core::Block) -> Result<(), Error>;
@@ -163,9 +163,12 @@ pub trait Protocol {
/// forwarding or querying of blocks and transactions from the network among
/// other things.
pub trait NetAdapter: Sync + Send {
/// Current height of our chain.
/// Current total difficulty on our chain
fn total_difficulty(&self) -> Difficulty;
/// Current total height
fn total_height(&self) -> u64;
/// A valid transaction has been received from one of our peers
fn transaction_received(&self, tx: core::Transaction);
@@ -196,5 +199,5 @@ pub trait NetAdapter: Sync + Send {
fn peer_connected(&self, &PeerInfo);
/// Heard total_difficulty from a connected peer (via ping/pong).
fn peer_difficulty(&self, SocketAddr, Difficulty);
fn peer_difficulty(&self, SocketAddr, Difficulty, u64);
}