aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin/receive.js
diff options
context:
space:
mode:
authorAdrien Hopkins <[email protected]>2022-06-14 16:01:21 -0500
committerAdrien Hopkins <[email protected]>2022-06-14 16:01:21 -0500
commit33338d09d6cb03f089c1f053c81503c0f8c11dbc (patch)
treea55364177265b04c67ccf66a5db76be30bfb6443 /routes/bitcoin/receive.js
parentffbd27b2e9ddcb52a37febc0855e16b4fe09dbdc (diff)
downloadcoinos-server-33338d09d6cb03f089c1f053c81503c0f8c11dbc.tar.gz
coinos-server-33338d09d6cb03f089c1f053c81503c0f8c11dbc.zip
Moved conversion fee calculation to a single file per currency
Diffstat (limited to 'routes/bitcoin/receive.js')
-rw-r--r--routes/bitcoin/receive.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 5bdbcb72..02deb58f 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -21,8 +21,7 @@ const network =
const queue = {};
const seen = [];
-// used to calculate how many credits to give
-const withdrawalFeeMultiplier = 0.01;
+import { computeConversionFee } from './conversionFee.js';
zmqRawTx.on("message", async (topic, message, sequence) => {
const hex = message.toString("hex");
@@ -195,7 +194,8 @@ setInterval(async () => {
{ pending: Math.min(account.pending, total) },
{ transaction }
);
- await account.increment({ fee_credits: Math.floor(total * withdrawalFeeMultiplier) }, { transaction });
+ // get the # of fee credits you would need to pay off this amount of bitcoin
+ await account.increment({ fee_credits: computeConversionFee(total) }, { transaction });
await account.reload({ transaction });
await p.save({ transaction });