use bitcoin::blockdata::transaction::Transaction;
use bitcoin::blockdata::script::Script;
use bitcoin::util::hash::Sha256dHash;
-use std::sync::{Mutex,Weak,MutexGuard};
+use util::logger::Logger;
+use std::sync::{Mutex,Weak,MutexGuard,Arc};
use std::sync::atomic::{AtomicUsize, Ordering};
/// An interface to request notification of certain scripts as they appear the
pub struct ChainWatchInterfaceUtil {
watched: Mutex<(Vec<Script>, Vec<(Sha256dHash, u32)>, bool)>, //TODO: Something clever to optimize this
listeners: Mutex<Vec<Weak<ChainListener>>>,
- reentered: AtomicUsize
+ reentered: AtomicUsize,
+ logger: Arc<Logger>,
}
/// Register listener
}
impl ChainWatchInterfaceUtil {
- pub fn new() -> ChainWatchInterfaceUtil {
+ pub fn new(logger: Arc<Logger>) -> ChainWatchInterfaceUtil {
ChainWatchInterfaceUtil {
watched: Mutex::new((Vec::new(), Vec::new(), false)),
listeners: Mutex::new(Vec::new()),
- reentered: AtomicUsize::new(1)
+ reentered: AtomicUsize::new(1),
+ logger: logger,
}
}