Skip to content

Commit e2bb7f6

Browse files
committed
f move chanmonupdateerr
1 parent 8952000 commit e2bb7f6

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ use bitcoin::hashes::sha256::Hash as Sha256;
3030
use bitcoin::hash_types::{BlockHash, WPubkeyHash};
3131

3232
use lightning::chain;
33-
use lightning::chain::{BestBlock, chainmonitor, channelmonitor, Confirm, Watch};
34-
use lightning::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, MonitorEvent};
33+
use lightning::chain::{BestBlock, ChannelMonitorUpdateErr, chainmonitor, channelmonitor, Confirm, Watch};
34+
use lightning::chain::channelmonitor::{ChannelMonitor, MonitorEvent};
3535
use lightning::chain::transaction::OutPoint;
3636
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
3737
use lightning::chain::keysinterface::{KeysInterface, InMemorySigner};
@@ -100,7 +100,7 @@ struct TestChainMonitor {
100100
pub logger: Arc<dyn Logger>,
101101
pub keys: Arc<KeyProvider>,
102102
pub chain_monitor: Arc<chainmonitor::ChainMonitor<EnforcingSigner, Arc<dyn chain::Filter>, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<TestPersister>>>,
103-
pub update_ret: Mutex<Result<(), channelmonitor::ChannelMonitorUpdateErr>>,
103+
pub update_ret: Mutex<Result<(), chain::ChannelMonitorUpdateErr>>,
104104
// If we reload a node with an old copy of ChannelMonitors, the ChannelManager deserialization
105105
// logic will automatically force-close our channels for us (as we don't have an up-to-date
106106
// monitor implying we are not able to punish misbehaving counterparties). Because this test
@@ -122,7 +122,7 @@ impl TestChainMonitor {
122122
}
123123
}
124124
impl chain::Watch<EnforcingSigner> for TestChainMonitor {
125-
fn watch_channel(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
125+
fn watch_channel(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), chain::ChannelMonitorUpdateErr> {
126126
let mut ser = VecWriter(Vec::new());
127127
monitor.write(&mut ser).unwrap();
128128
if let Some(_) = self.latest_monitors.lock().unwrap().insert(funding_txo, (monitor.get_latest_update_id(), ser.0)) {
@@ -133,7 +133,7 @@ impl chain::Watch<EnforcingSigner> for TestChainMonitor {
133133
self.update_ret.lock().unwrap().clone()
134134
}
135135

136-
fn update_channel(&self, funding_txo: OutPoint, update: channelmonitor::ChannelMonitorUpdate) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
136+
fn update_channel(&self, funding_txo: OutPoint, update: channelmonitor::ChannelMonitorUpdate) -> Result<(), chain::ChannelMonitorUpdateErr> {
137137
let mut map_lock = self.latest_monitors.lock().unwrap();
138138
let mut map_entry = match map_lock.entry(funding_txo) {
139139
hash_map::Entry::Occupied(entry) => entry,

fuzz/src/utils/test_persister.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
use lightning::chain;
12
use lightning::chain::channelmonitor;
23
use lightning::chain::transaction::OutPoint;
34
use lightning::util::enforcing_trait_impls::EnforcingSigner;
45

56
pub struct TestPersister {}
67
impl channelmonitor::Persist<EnforcingSigner> for TestPersister {
7-
fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
8+
fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), chain::ChannelMonitorUpdateErr> {
89
Ok(())
910
}
1011

11-
fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &channelmonitor::ChannelMonitorUpdate, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
12+
fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &channelmonitor::ChannelMonitorUpdate, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), chain::ChannelMonitorUpdateErr> {
13+
Ok(())
14+
}
15+
16+
fn sync_persisted_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), ()> {
1217
Ok(())
1318
}
1419
}

0 commit comments

Comments
 (0)