Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVStore upstreaming followups #2563

Merged

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Sep 8, 2023

Closes #2561.

Addresses two last feedback items from #2472.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Works ✅

@tnull
Copy link
Contributor Author

tnull commented Sep 11, 2023

Force-pushed including the following changes:

> git diff-tree -U2  9ea0d03f aeaed628
diff --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:main Sep 11, 2023
11 of 14 checks passed
Sign up for free to 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