refactor verification

This commit is contained in:
NikVolf 2016-11-17 21:26:17 +03:00
parent e0066504d2
commit b9793e06dd
4 changed files with 6 additions and 8 deletions

View File

@ -39,6 +39,8 @@ pub enum BlockLocation {
Side(u32),
}
pub type SharedStore = std::sync::Arc<Store + Send + Sync>;
pub use best_block::BestBlock;
pub use storage::{Storage, Store};
pub use error::Error;

View File

@ -2,7 +2,7 @@
use std::{self, fs};
use std::path::Path;
use kvdb::{DBTransaction, Database, DatabaseConfig};
use kvdb::{Database, DatabaseConfig};
use byteorder::{LittleEndian, ByteOrder};
use primitives::hash::H256;
use primitives::bytes::Bytes;
@ -11,7 +11,6 @@ use serialization;
use chain::{self, RepresentH256};
use parking_lot::RwLock;
use transaction_meta::TransactionMeta;
use std::collections::HashMap;
use error::{Error, ConsistencyError, MetaError};
use update_context::UpdateContext;

View File

@ -1,6 +1,5 @@
use transaction_meta::TransactionMeta;
use primitives::hash::H256;
use primitives::bytes::Bytes;
pub trait TransactionMetaProvider {
/// get transaction metadata

View File

@ -1,7 +1,5 @@
//! Bitcoin chain verifier
use std::sync::Arc;
use db::{self, BlockRef, BlockLocation};
use chain::{self, RepresentH256};
use super::{Verify, VerificationResult, Chain, Error, TransactionError, ContinueVerify};
@ -13,7 +11,7 @@ const MAX_BLOCK_SIGOPS: usize = 20000;
const MAX_BLOCK_SIZE: usize = 1000000;
pub struct ChainVerifier {
store: Arc<db::Store>,
store: db::SharedStore,
verify_p2sh: bool,
verify_clocktimeverify: bool,
skip_pow: bool,
@ -21,7 +19,7 @@ pub struct ChainVerifier {
}
impl ChainVerifier {
pub fn new(store: Arc<db::Store>) -> Self {
pub fn new(store: db::SharedStore) -> Self {
ChainVerifier {
store: store,
verify_p2sh: false,
@ -276,7 +274,7 @@ mod tests {
use super::ChainVerifier;
use super::super::{Verify, Chain, Error, TransactionError};
use db::{TestStorage, Storage, Store};
use db::{TestStorage, Storage, Store, BlockStapler};
use test_data;
use std::sync::Arc;
use devtools::RandomTempPath;