refactor verification
This commit is contained in:
parent
e0066504d2
commit
b9793e06dd
|
@ -39,6 +39,8 @@ pub enum BlockLocation {
|
||||||
Side(u32),
|
Side(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type SharedStore = std::sync::Arc<Store + Send + Sync>;
|
||||||
|
|
||||||
pub use best_block::BestBlock;
|
pub use best_block::BestBlock;
|
||||||
pub use storage::{Storage, Store};
|
pub use storage::{Storage, Store};
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use std::{self, fs};
|
use std::{self, fs};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use kvdb::{DBTransaction, Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use byteorder::{LittleEndian, ByteOrder};
|
use byteorder::{LittleEndian, ByteOrder};
|
||||||
use primitives::hash::H256;
|
use primitives::hash::H256;
|
||||||
use primitives::bytes::Bytes;
|
use primitives::bytes::Bytes;
|
||||||
|
@ -11,7 +11,6 @@ use serialization;
|
||||||
use chain::{self, RepresentH256};
|
use chain::{self, RepresentH256};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use transaction_meta::TransactionMeta;
|
use transaction_meta::TransactionMeta;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use error::{Error, ConsistencyError, MetaError};
|
use error::{Error, ConsistencyError, MetaError};
|
||||||
use update_context::UpdateContext;
|
use update_context::UpdateContext;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use transaction_meta::TransactionMeta;
|
use transaction_meta::TransactionMeta;
|
||||||
use primitives::hash::H256;
|
use primitives::hash::H256;
|
||||||
use primitives::bytes::Bytes;
|
|
||||||
|
|
||||||
pub trait TransactionMetaProvider {
|
pub trait TransactionMetaProvider {
|
||||||
/// get transaction metadata
|
/// get transaction metadata
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
//! Bitcoin chain verifier
|
//! Bitcoin chain verifier
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use db::{self, BlockRef, BlockLocation};
|
use db::{self, BlockRef, BlockLocation};
|
||||||
use chain::{self, RepresentH256};
|
use chain::{self, RepresentH256};
|
||||||
use super::{Verify, VerificationResult, Chain, Error, TransactionError, ContinueVerify};
|
use super::{Verify, VerificationResult, Chain, Error, TransactionError, ContinueVerify};
|
||||||
|
@ -13,7 +11,7 @@ const MAX_BLOCK_SIGOPS: usize = 20000;
|
||||||
const MAX_BLOCK_SIZE: usize = 1000000;
|
const MAX_BLOCK_SIZE: usize = 1000000;
|
||||||
|
|
||||||
pub struct ChainVerifier {
|
pub struct ChainVerifier {
|
||||||
store: Arc<db::Store>,
|
store: db::SharedStore,
|
||||||
verify_p2sh: bool,
|
verify_p2sh: bool,
|
||||||
verify_clocktimeverify: bool,
|
verify_clocktimeverify: bool,
|
||||||
skip_pow: bool,
|
skip_pow: bool,
|
||||||
|
@ -21,7 +19,7 @@ pub struct ChainVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainVerifier {
|
impl ChainVerifier {
|
||||||
pub fn new(store: Arc<db::Store>) -> Self {
|
pub fn new(store: db::SharedStore) -> Self {
|
||||||
ChainVerifier {
|
ChainVerifier {
|
||||||
store: store,
|
store: store,
|
||||||
verify_p2sh: false,
|
verify_p2sh: false,
|
||||||
|
@ -276,7 +274,7 @@ mod tests {
|
||||||
|
|
||||||
use super::ChainVerifier;
|
use super::ChainVerifier;
|
||||||
use super::super::{Verify, Chain, Error, TransactionError};
|
use super::super::{Verify, Chain, Error, TransactionError};
|
||||||
use db::{TestStorage, Storage, Store};
|
use db::{TestStorage, Storage, Store, BlockStapler};
|
||||||
use test_data;
|
use test_data;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
|
|
Loading…
Reference in New Issue