Skip to content

KVStore upstreaming followups - #2563

Merged
valentinewallace merged 2 commits into
lightningdevkit:mainfrom
tnull:2023-09-kvstore-followups
Sep 11, 2023
Merged

KVStore upstreaming followups#2563
valentinewallace merged 2 commits into
lightningdevkit:mainfrom
tnull:2023-09-kvstore-followups

Conversation

@tnull

@tnulltnull commented Sep 8, 2023

Copy link
Copy Markdown
Contributor

Closes#2561.

Addresses two last feedback items from #2472.

@tnull
tnullforce-pushed the 2023-09-kvstore-followups branch from b2c28a6 to 9ea0d03CompareSeptember 8, 2023 08:10
Comment threadlightning/src/util/persist.rs Outdated
valentinewallace
valentinewallace previously approved these changes Sep 8, 2023

@valentinewallacevalentinewallace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works ✅

Comment threadlightning/src/util/persist.rs Outdated
@tnull

Copy link
Copy Markdown
ContributorAuthor

Force-pushed including the following changes:

> git diff-tree -U2 9ea0d03f aeaed628diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs
index 7a73aba0..372a094a 100644
--- a/lightning/src/util/persist.rs+++ b/lightning/src/util/persist.rs@@ -180,5 +180,4 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, K: KVStore> Persist<ChannelSign
fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
let key = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
- debug_assert!(key.len() > 65);
match self.write(
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
@@ -193,5 +192,4 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, K: KVStore> Persist<ChannelSign
fn update_persisted_channel(&self, funding_txo: OutPoint, _update: Option<&ChannelMonitorUpdate>, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
let key = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
- debug_assert!(key.len() > 65);
match self.write(
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
@@ -219,6 +217,5 @@ where
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE)?
{
- debug_assert!(stored_key.len() > 65);- if stored_key.len() < 65 {+ if stored_key.len() < 66 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,

@valentinewallace
valentinewallace merged commit 8de8861 into lightningdevkit:mainSep 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_channel_monitors can panic on invalid keys

4 participants

@tnull@TheBlueMatt@G8XSU@valentinewallace