Improve block and transaction propagation (#9954)

* Refactor sync to add priority tasks.

* Send priority tasks notifications.

* Propagate blocks, optimize transactions.

* Implement transaction propagation. Use sync_channel.

* Tone down info.

* Prevent deadlock by not waiting forever for sync lock.

* Fix lock order.

* Don't use sync_channel to prevent deadlocks.

* Fix tests.
This commit is contained in:
Tomasz Drwięga
2018-11-28 10:30:05 +00:00
committed by Afri Schoedon
parent 14c9cbd40e
commit 0b5bbf6048
18 changed files with 631 additions and 300 deletions

View File

@@ -21,11 +21,13 @@ extern crate plain_hasher;
use ethereum_types::H256;
use std::hash;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use plain_hasher::PlainHasher;
/// Specialized version of `HashMap` with H256 keys and fast hashing function.
pub type H256FastMap<T> = HashMap<H256, T, hash::BuildHasherDefault<PlainHasher>>;
/// Specialized version of HashSet with H256 values and fast hashing function.
pub type H256FastSet = HashSet<H256, hash::BuildHasherDefault<PlainHasher>>;
#[cfg(test)]
mod tests {
@@ -36,4 +38,4 @@ mod tests {
let mut h = H256FastMap::default();
h.insert(H256::from(123), "abc");
}
}
}