mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 08:51:08 +03:00
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:
parent
e4be820671
commit
a011450825
2 changed files with 321 additions and 315 deletions
626
Cargo.lock
generated
626
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -146,7 +146,7 @@ impl OrphanBlockPool {
|
||||||
pub struct Chain {
|
pub struct Chain {
|
||||||
db_root: String,
|
db_root: String,
|
||||||
store: Arc<store::ChainStore>,
|
store: Arc<store::ChainStore>,
|
||||||
adapter: Arc<ChainAdapter>,
|
adapter: Arc<ChainAdapter + Send + Sync>,
|
||||||
orphans: Arc<OrphanBlockPool>,
|
orphans: Arc<OrphanBlockPool>,
|
||||||
txhashset: Arc<RwLock<txhashset::TxHashSet>>,
|
txhashset: Arc<RwLock<txhashset::TxHashSet>>,
|
||||||
// Recently processed blocks to avoid double-processing
|
// Recently processed blocks to avoid double-processing
|
||||||
|
@ -158,9 +158,6 @@ pub struct Chain {
|
||||||
genesis: BlockHeader,
|
genesis: BlockHeader,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Sync for Chain {}
|
|
||||||
unsafe impl Send for Chain {}
|
|
||||||
|
|
||||||
impl Chain {
|
impl Chain {
|
||||||
/// Initializes the blockchain and returns a new Chain instance. Does a
|
/// 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
|
/// check on the current chain head to make sure it exists and creates one
|
||||||
|
@ -168,7 +165,7 @@ impl Chain {
|
||||||
pub fn init(
|
pub fn init(
|
||||||
db_root: String,
|
db_root: String,
|
||||||
db_env: Arc<lmdb::Environment>,
|
db_env: Arc<lmdb::Environment>,
|
||||||
adapter: Arc<ChainAdapter>,
|
adapter: Arc<ChainAdapter + Send + Sync>,
|
||||||
genesis: Block,
|
genesis: Block,
|
||||||
pow_verifier: fn(&BlockHeader, u8) -> Result<(), pow::Error>,
|
pow_verifier: fn(&BlockHeader, u8) -> Result<(), pow::Error>,
|
||||||
verifier_cache: Arc<RwLock<VerifierCache>>,
|
verifier_cache: Arc<RwLock<VerifierCache>>,
|
||||||
|
@ -986,7 +983,8 @@ impl Chain {
|
||||||
if outputs.0 != rangeproofs.0 || outputs.1.len() != rangeproofs.1.len() {
|
if outputs.0 != rangeproofs.0 || outputs.1.len() != rangeproofs.1.len() {
|
||||||
return Err(ErrorKind::TxHashSetErr(String::from(
|
return Err(ErrorKind::TxHashSetErr(String::from(
|
||||||
"Output and rangeproof sets don't match",
|
"Output and rangeproof sets don't match",
|
||||||
)).into());
|
))
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
let mut output_vec: Vec<Output> = vec![];
|
let mut output_vec: Vec<Output> = vec![];
|
||||||
for (ref x, &y) in outputs.1.iter().zip(rangeproofs.1.iter()) {
|
for (ref x, &y) in outputs.1.iter().zip(rangeproofs.1.iter()) {
|
||||||
|
|
Loading…
Reference in a new issue