From f3a9d3d614f2a6df8fb32c76f4f02d53be872ddb Mon Sep 17 00:00:00 2001 From: Dorian Date: Fri, 13 Feb 2026 21:34:07 +0000 Subject: [PATCH] fix: decouple rent payouts from rate API, correct sats terminology Rent shareholder payouts are denominated in sats and don't need a USD/sat exchange rate. Skip the getSatoshiRate() call for rent-type payments so they are never blocked by rate-API 429s or outages. Also fix a misleading log message that said "USD" instead of "sats". Co-authored-by: Cursor --- backend/src/payment/services/payment.service.ts | 14 +++++++++----- backend/src/rents/rents.service.ts | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/src/payment/services/payment.service.ts b/backend/src/payment/services/payment.service.ts index a76e9e7..46c4671 100644 --- a/backend/src/payment/services/payment.service.ts +++ b/backend/src/payment/services/payment.service.ts @@ -195,12 +195,16 @@ export class PaymentService { type: 'watch' | 'rent' = 'watch', frequency: Frequency = 'automatic', ) { - const satoshiRate = await this.provider.getSatoshiRate(); - const column = type === 'watch' ? 'pendingRevenue' : 'rentPendingRevenue'; - // Rental prices (and therefore rentPendingRevenue) are denominated in - // sats, not USD. Use a 1-sat minimum threshold for rentals instead of - // the USD-based satoshiRate. + // sats, not USD. The satoshi rate is only needed for watch/subscription + // payments which store revenue in USD. Skip the rate fetch entirely for + // rent payouts so they are never blocked by rate-API outages or 429s. + let satoshiRate = 0; + if (type !== 'rent') { + satoshiRate = await this.provider.getSatoshiRate(); + } + + const column = type === 'watch' ? 'pendingRevenue' : 'rentPendingRevenue'; const minThreshold = type === 'rent' ? 1 : satoshiRate; const options: FindManyOptions = { diff --git a/backend/src/rents/rents.service.ts b/backend/src/rents/rents.service.ts index cdda366..1451d29 100644 --- a/backend/src/rents/rents.service.ts +++ b/backend/src/rents/rents.service.ts @@ -236,7 +236,7 @@ export class RentsService { .execute(); Logger.log( - `Credited ${total} USD to ${ids.length} shareholder(s) via project fallback for content ${contentId}`, + `Credited ${total} sats to ${ids.length} shareholder(s) via project fallback for content ${contentId}`, 'RentsService', ); } catch (err) {