Skip to content

Commit

Permalink
fix: ensure we pull records before prepare_send
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse committed Dec 5, 2024
1 parent 79b3d8d commit f762613
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/core/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,12 @@ impl LiquidSdk {
};
}
InputType::Bolt11 { invoice } => {
self.sync_service
.pull()
.await
.map_err(|err| PaymentError::Generic {
err: format!("Could not pull real-time sync changes: {err:?}"),
})?;
self.ensure_send_is_not_self_transfer(&invoice.bolt11)?;
self.validate_invoice(&invoice.bolt11)?;

Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl SyncService {
Ok(())
}

async fn pull(&self) -> Result<()> {
pub(crate) async fn pull(&self) -> Result<()> {
// Step 1: Fetch and save incoming records from remote, then update local tip
self.fetch_and_save_records().await?;

Expand Down

0 comments on commit f762613

Please sign in to comment.