Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
Merge pull request #986 from MutinyWallet/nwc-fixes
Browse files Browse the repository at this point in the history
Various NWC fixes
  • Loading branch information
AnthonyRonning authored Jan 25, 2024
2 parents a06917d + 5f3191e commit 7b44ff6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mutiny-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ impl<S: MutinyStorage> InvoiceHandler for MutinyWallet<S> {
}

async fn get_outbound_payment_status(&self, payment_hash: &[u8; 32]) -> Option<HTLCStatus> {
self.get_invoice_by_hash(&sha256::Hash::hash(payment_hash))
self.get_invoice_by_hash(&sha256::Hash::from_inner(*payment_hash))
.await
.ok()
.map(|p| p.status)
Expand Down
9 changes: 6 additions & 3 deletions mutiny-core/src/nostr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl<S: MutinyStorage> NostrManager<S> {
self.storage.set_nwc_sync_time(now.as_u64())?;
now
}
Some(time) => Timestamp::from(time),
Some(time) => Timestamp::from(time + 1), // add one so we get only new events
};

let vec = self
Expand Down Expand Up @@ -168,7 +168,7 @@ impl<S: MutinyStorage> NostrManager<S> {
self.storage.set_dm_sync_time(now.as_u64())?;
now
}
Some(time) => Timestamp::from(time),
Some(time) => Timestamp::from(time + 1), // add one so we get only new events
};

let received_dm_filter = Filter::new()
Expand Down Expand Up @@ -509,7 +509,10 @@ impl<S: MutinyStorage> NostrManager<S> {
) -> Result<NwcProfile, MutinyError> {
let profile = self.create_new_profile(profile_type, spending_conditions, tag)?;
// add relay if needed
self.client.add_relay(profile.relay.as_str()).await?;
let needs_connect = self.client.add_relay(profile.relay.as_str()).await?;
if needs_connect {
self.client.connect_relay(profile.relay.as_str()).await?;
}

let info_event = self.nwc.read().unwrap().iter().find_map(|nwc| {
if nwc.profile.index == profile.index {
Expand Down

0 comments on commit 7b44ff6

Please sign in to comment.