diff options
| author | Adrien Hopkins <[email protected]> | 2022-06-14 16:01:21 -0500 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2022-06-14 16:01:21 -0500 |
| commit | 33338d09d6cb03f089c1f053c81503c0f8c11dbc (patch) | |
| tree | a55364177265b04c67ccf66a5db76be30bfb6443 /routes/bitcoin/receive.js | |
| parent | ffbd27b2e9ddcb52a37febc0855e16b4fe09dbdc (diff) | |
| download | coinos-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.js | 6 |
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 }); |
