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 <cursoragent@cursor.com>
This commit is contained in:
Dorian
2026-02-13 21:34:07 +00:00
parent c84c4e92b7
commit f3a9d3d614
2 changed files with 10 additions and 6 deletions

View File

@@ -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<Shareholder> = {

View File

@@ -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) {