projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure we read the full TLV stream length when maybe-reading `None`
[rust-lightning]
/
lightning
/
src
/
chain
/
chainmonitor.rs
diff --git
a/lightning/src/chain/chainmonitor.rs
b/lightning/src/chain/chainmonitor.rs
index 8c7bafe3e53350610e2d0c7cea10b13912fa1170..14544754318ad5945622c42bd0300679aef6a6de 100644
(file)
--- a/
lightning/src/chain/chainmonitor.rs
+++ b/
lightning/src/chain/chainmonitor.rs
@@
-35,7
+35,7
@@
use crate::sign::ecdsa::WriteableEcdsaChannelSigner;
use crate::events;
use crate::events::{Event, EventHandler};
use crate::util::atomic_counter::AtomicCounter;
use crate::events;
use crate::events::{Event, EventHandler};
use crate::util::atomic_counter::AtomicCounter;
-use crate::util::logger::
Logger
;
+use crate::util::logger::
{Logger, WithContext}
;
use crate::util::errors::APIError;
use crate::util::wakers::{Future, Notifier};
use crate::ln::channelmanager::ChannelDetails;
use crate::util::errors::APIError;
use crate::util::wakers::{Future, Notifier};
use crate::ln::channelmanager::ChannelDetails;
@@
-402,7
+402,8
@@
where C::Target: chain::Filter,
outpoint: OutPoint { txid, index: idx as u16 },
script_pubkey: output.script_pubkey,
};
outpoint: OutPoint { txid, index: idx as u16 },
script_pubkey: output.script_pubkey,
};
- chain_source.register_output(output)
+ log_trace!(logger, "Adding monitoring for spends of outpoint {} to the filter", output.outpoint);
+ chain_source.register_output(output);
}
}
}
}
}
}
@@
-741,7
+742,7
@@
where C::Target: chain::Filter,
},
}
if let Some(ref chain_source) = self.chain_source {
},
}
if let Some(ref chain_source) = self.chain_source {
- monitor.load_outputs_to_watch(chain_source);
+ monitor.load_outputs_to_watch(chain_source
, &self.logger
);
}
entry.insert(MonitorHolder {
monitor,
}
entry.insert(MonitorHolder {
monitor,
@@
-753,11
+754,11
@@
where C::Target: chain::Filter,
fn update_channel(&self, funding_txo: OutPoint, update: &ChannelMonitorUpdate) -> ChannelMonitorUpdateStatus {
// Update the monitor that watches the channel referred to by the given outpoint.
fn update_channel(&self, funding_txo: OutPoint, update: &ChannelMonitorUpdate) -> ChannelMonitorUpdateStatus {
// Update the monitor that watches the channel referred to by the given outpoint.
- let monitors_lock = self.monitors.read().unwrap();
- let monitors = monitors_lock.deref();
+ let monitors = self.monitors.read().unwrap();
match monitors.get(&funding_txo) {
None => {
match monitors.get(&funding_txo) {
None => {
- log_error!(self.logger, "Failed to update channel monitor: no such monitor registered");
+ let logger = WithContext::from(&self.logger, update.counterparty_node_id, Some(funding_txo.to_channel_id()));
+ log_error!(logger, "Failed to update channel monitor: no such monitor registered");
// We should never ever trigger this from within ChannelManager. Technically a
// user could use this object with some proxying in between which makes this
// We should never ever trigger this from within ChannelManager. Technically a
// user could use this object with some proxying in between which makes this
@@
-797,6
+798,7
@@
where C::Target: chain::Filter,
ChannelMonitorUpdateStatus::UnrecoverableError => {
// Take the monitors lock for writing so that we poison it and any future
// operations going forward fail immediately.
ChannelMonitorUpdateStatus::UnrecoverableError => {
// Take the monitors lock for writing so that we poison it and any future
// operations going forward fail immediately.
+ core::mem::drop(pending_monitor_updates);
core::mem::drop(monitors);
let _poison = self.monitors.write().unwrap();
let err_str = "ChannelMonitor[Update] persistence failed unrecoverably. This indicates we cannot continue normal operation and must shut down.";
core::mem::drop(monitors);
let _poison = self.monitors.write().unwrap();
let err_str = "ChannelMonitor[Update] persistence failed unrecoverably. This indicates we cannot continue normal operation and must shut down.";