Skip to content

Commit e7d3781

Browse files
authored
Merge pull request #976 from TheBlueMatt/2021-06-actionable-errors
Make errors actionable when failing to deserialize a ChannelManager
2 parents 4353d4a + e8110ab commit e7d3781

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,6 +4667,8 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
46674667
log_bytes!(channel.channel_id()), monitor.get_latest_update_id(), channel.get_latest_monitor_update_id());
46684668
log_error!(args.logger, " The chain::Watch API *requires* that monitors are persisted durably before returning,");
46694669
log_error!(args.logger, " client applications must ensure that ChannelMonitor data is always available and the latest to avoid funds loss!");
4670+
log_error!(args.logger, " Without the latest ChannelMonitor we cannot continue without risking funds.");
4671+
log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/rust-bitcoin/rust-lightning");
46704672
return Err(DecodeError::InvalidValue);
46714673
} else if channel.get_cur_holder_commitment_transaction_number() > monitor.get_cur_holder_commitment_number() ||
46724674
channel.get_revoked_counterparty_commitment_transaction_number() > monitor.get_min_seen_secret() ||
@@ -4686,6 +4688,8 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
46864688
log_error!(args.logger, "Missing ChannelMonitor for channel {} needed by ChannelManager.", log_bytes!(channel.channel_id()));
46874689
log_error!(args.logger, " The chain::Watch API *requires* that monitors are persisted durably before returning,");
46884690
log_error!(args.logger, " client applications must ensure that ChannelMonitor data is always available and the latest to avoid funds loss!");
4691+
log_error!(args.logger, " Without the ChannelMonitor we cannot continue without risking funds.");
4692+
log_error!(args.logger, " Please ensure the chain::Watch API requirements are met and file a bug report at https://github.com/rust-bitcoin/rust-lightning");
46894693
return Err(DecodeError::InvalidValue);
46904694
}
46914695
}

lightning/src/util/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl TestLogger {
439439
impl Logger for TestLogger {
440440
fn log(&self, record: &Record) {
441441
*self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1;
442-
if self.level >= record.level {
442+
if record.level >= self.level {
443443
println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
444444
}
445445
}

0 commit comments

Comments
 (0)