From 02472bb81fddbbe605366f2c013fbca1131a1306 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 8 Jul 2024 16:07:35 +0200 Subject: [PATCH] Fix missing stackedMsats update + wrong sybil fee (#1256) * Fix 'stackedMsats' not updated * Fix 1% fee instead of 10% --- api/paidAction/zap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/paidAction/zap.js b/api/paidAction/zap.js index f5c9c169..6dc3cc90 100644 --- a/api/paidAction/zap.js +++ b/api/paidAction/zap.js @@ -11,7 +11,7 @@ export async function getCost ({ sats }) { } export async function perform ({ invoiceId, sats, id: itemId, ...args }, { me, cost, tx }) { - const feeMsats = cost / BigInt(100) + const feeMsats = cost / BigInt(10) // 10% fee const zapMsats = cost - feeMsats itemId = parseInt(itemId) @@ -84,7 +84,9 @@ export async function onPaid ({ invoice, actIds }, { models, tx }) { WHERE users.id = forwardees."userId" ) UPDATE users - SET msats = msats + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT + SET + msats = msats + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT, + "stackedMsats" = "stackedMsats" + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT WHERE id = ${itemAct.item.userId}::INTEGER` // perform denomormalized aggregates: weighted votes, upvotes, msats, lastZapAt