aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin/receive.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/bitcoin/receive.js')
-rw-r--r--routes/bitcoin/receive.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 5d8e21e7..5bdbcb72 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -21,6 +21,9 @@ const network =
const queue = {};
const seen = [];
+// used to calculate how many credits to give
+const withdrawalFeeMultiplier = 0.01;
+
zmqRawTx.on("message", async (topic, message, sequence) => {
const hex = message.toString("hex");
let tx = bitcoin.Transaction.fromHex(message);
@@ -192,6 +195,7 @@ setInterval(async () => {
{ pending: Math.min(account.pending, total) },
{ transaction }
);
+ await account.increment({ fee_credits: Math.floor(total * withdrawalFeeMultiplier) }, { transaction });
await account.reload({ transaction });
await p.save({ transaction });