Remove unsafe from chain (#1990)

Now roaring bitmap implements Sync and Send, we don't need to implement
it manually for Chain
This commit is contained in:
hashmap 2018-11-15 23:27:42 +01:00 committed by GitHub
parent e4be820671
commit a011450825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 321 additions and 315 deletions

626
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -146,7 +146,7 @@ impl OrphanBlockPool {
pub struct Chain {
db_root: String,
store: Arc<store::ChainStore>,
adapter: Arc<ChainAdapter>,
adapter: Arc<ChainAdapter + Send + Sync>,
orphans: Arc<OrphanBlockPool>,
txhashset: Arc<RwLock<txhashset::TxHashSet>>,
// Recently processed blocks to avoid double-processing
@ -158,9 +158,6 @@ pub struct Chain {
genesis: BlockHeader,
}
unsafe impl Sync for Chain {}
unsafe impl Send for Chain {}
impl Chain {
/// Initializes the blockchain and returns a new Chain instance. Does a
/// check on the current chain head to make sure it exists and creates one
@ -168,7 +165,7 @@ impl Chain {
pub fn init(
db_root: String,
db_env: Arc<lmdb::Environment>,
adapter: Arc<ChainAdapter>,
adapter: Arc<ChainAdapter + Send + Sync>,
genesis: Block,
pow_verifier: fn(&BlockHeader, u8) -> Result<(), pow::Error>,
verifier_cache: Arc<RwLock<VerifierCache>>,
@ -986,7 +983,8 @@ impl Chain {
if outputs.0 != rangeproofs.0 || outputs.1.len() != rangeproofs.1.len() {
return Err(ErrorKind::TxHashSetErr(String::from(
"Output and rangeproof sets don't match",
)).into());
))
.into());
}
let mut output_vec: Vec<Output> = vec![];
for (ref x, &y) in outputs.1.iter().zip(rangeproofs.1.iter()) {