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

Fix removing payment from in-memory store #514

Merged
merged 2 commits into from
Apr 1, 2025

Conversation

andrei-21
Copy link
Contributor

I all other places self.payments state is synchronized with self.kv_store. I guess here it should be as well, no?

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 28, 2025

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull tnull requested review from tnull and removed request for joostjager March 28, 2025 15:28
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Ah good catch indeed!

Please make these changes two commits though, and provide proper commit descriptions for both.

log_error!(
self.logger,
"Removing payment data for key {}/{}/{} failed due to: {}",
if self.payments.lock().unwrap().remove(id).is_some() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please introduce a variable for this, especially since it would allow us to drop the lock again before the KVStore IO operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

.filter(f)
.cloned()
.collect::<Vec<PaymentDetails>>()
self.payments.lock().unwrap().values().filter(f).cloned().collect()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess, but please make this a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -712,8 +708,7 @@ where
e
);
Error::PersistenceFailed
})?;
Ok(())
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

No, please revert this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@tnull tnull added this to the 0.5 milestone Mar 28, 2025
@andrei-21 andrei-21 force-pushed the fix/remove-payment branch from 2541f65 to c32b646 Compare March 31, 2025 21:30
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@tnull tnull merged commit fb23bad into lightningdevkit:main Apr 1, 2025
15 checks passed
@andrei-21 andrei-21 deleted the fix/remove-payment branch April 1, 2025 07:43
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.

3 participants