Skip to content

Commit

Permalink
chore: use find instead of fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 17, 2024
1 parent 53a9208 commit 6442573
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/nwc/nwcPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export class NWCPool {
bolt11: transaction.invoice,
paidAt: new Date(transaction.settled_at * 1000)
})
const relays = requestEvent.tags.filter(tag => tag[0] === 'relays')[0].slice(1);
if (!relays.length) {
const relays = requestEvent.tags.find(tag => tag[0] === 'relays')?.slice(1);
if (!relays || !relays.length) {
logger.error("no relays specified in zap request", { user_id: userId, transaction });
return;
}
Expand All @@ -89,7 +89,8 @@ export class NWCPool {
logger.error("failed to publish zap", {
user_id: userId,
event_id: signedEvent.id,
payment_hash: transaction.payment_hash,
payment_hash: transaction.payment_hash,
failed_relays: relays,
});
return;
}
Expand Down

0 comments on commit 6442573

Please sign in to comment.