X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=d53cd39b119fac08d8ebb151204d9c4e53a2a4a3;hb=a37a16a3ce25023fe9ff3c45dcba7e6b942f2de8;hp=8e2be87d8bef820b4bf56b19829aa09450a9f1d6;hpb=1c9df02cbf51b6e6ac15f3d52da5f95f8b7beed2;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 8e2be87d..d53cd39b 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -62,7 +62,6 @@ use regex; use crate::io; use crate::prelude::*; use core::cell::RefCell; -use core::ops::Deref; use core::time::Duration; use crate::sync::{Mutex, Arc}; use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; @@ -226,7 +225,7 @@ impl<'a> TestChainMonitor<'a> { } } impl<'a> chain::Watch for TestChainMonitor<'a> { - fn watch_channel(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor) -> chain::ChannelMonitorUpdateStatus { + fn watch_channel(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor) -> Result { // At every point where we get a monitor update, we should be able to send a useful monitor // to a watchtower and disk... let mut w = TestVecWriter(Vec::new()); @@ -297,6 +296,7 @@ pub(crate) struct WatchtowerPersister { } impl WatchtowerPersister { + #[cfg(test)] pub(crate) fn new(destination_script: Script) -> Self { WatchtowerPersister { persister: TestPersister::new(), @@ -306,6 +306,7 @@ impl WatchtowerPersister { } } + #[cfg(test)] pub(crate) fn justice_tx(&self, funding_txo: OutPoint, commitment_txid: &Txid) -> Option { self.watchtower_state.lock().unwrap().get(&funding_txo).unwrap().get(commitment_txid).cloned() @@ -426,7 +427,7 @@ impl chainmonitor::Persist fo } } -pub(crate) struct TestStore { +pub struct TestStore { persisted_bytes: Mutex>>>, read_only: bool, }