Closed ekzyis closed 2 weeks ago
Only 5016 sats were forwarded to anon:
SELECT SUM(msats * pct / 100) FROM "ItemForward"
JOIN "Item" ON "Item"."id" = "ItemForward"."itemId"
WHERE "ItemForward"."userId" = 27;
-- returns 5,015,980 as of today
Since anon zaps were included in rewards, rewards only missed these 5k sats.
Closing because this conflicts with #1195 so we will wait for #1195
Description
Fix #1232 by donating any sats forwarded to anon.
Diff of
item_act
function:Additional Context
I initially wanted to include anon forwards in anon's stack in rewards. However, after looking in the code and considering the required changes, I think it's better to simply show them as donations.
I considered following approaches:
1. no changes to rewards query
In
item_act
, pretend that anon was zapped instead of adding forwarded sats to anon's balance. This would mean adding a row toItemAct
. But this would then mean that for anon forwards, threeItemAct
rows are inserted (2xTIP
+FEE
) with their msats sum being higher than the zap itself. This might break some assumptions in queries but decreasing the amount of msats for the originalTIP
might as well.So this approach seems to complicated for this requirement.
2. changes to rewards query
We could add a column
forwarded
to theDonations
table. Donations as part of anon forwards are marked with forwarded whereas normal donations are not. We then query the rows with forwarded set separately as part of anon's stack in the rewards query. This is a lot simpler but adds a column toDonations
for something very specific.Checklist
Are your changes backwards compatible? Please answer below:
Yes
Did you QA this? Could we deploy this straight to production? Please answer below:
tACK 3ca6fe1e
For frontend changes: Tested on mobile? Please answer below:
Did you introduce any new environment variables? If so, call them out explicitly here:
No