Skip to content

Commit

Permalink
Merge pull request #760 from getlipa/fix/deadlock-in-get-payment
Browse files Browse the repository at this point in the history
Fix deadlock in `get_payment`
  • Loading branch information
danielgranhao authored Nov 15, 2023
2 parents d24859d + 1f02fec commit 96b57bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,10 @@ impl LightningNode {
/// Parameters:
/// * `hash` - hex representation of payment hash
pub fn get_payment(&self, hash: String) -> Result<Payment> {
let optional_invoice = self
.data_store
.lock_unwrap()
.retrieve_created_invoice_by_hash(&hash)?;
if let Some(breez_payment) = self
.rt
.handle()
Expand All @@ -966,11 +970,7 @@ impl LightningNode {
)?
{
self.payment_from_breez_payment(breez_payment)
} else if let Some(invoice) = self
.data_store
.lock_unwrap()
.retrieve_created_invoice_by_hash(&hash)?
{
} else if let Some(invoice) = optional_invoice {
self.payment_from_created_invoice(&invoice)
} else {
invalid_input!("No payment with provided hash was found");
Expand Down

0 comments on commit 96b57bd

Please sign in to comment.