diff options
| author | Adam Soltys <[email protected]> | 2024-08-23 23:39:05 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-08-23 23:39:05 -0700 |
| commit | 193457c5bd6c7c892c3be50674579dabd07fd2f2 (patch) | |
| tree | 82792280db6ea9945643a76112a210d904d49239 /lib/invoices.js | |
| parent | 7be5db4d1dae7226a48623f42aca864adfa54e02 (diff) | |
| download | coinos-server-193457c5bd6c7c892c3be50674579dabd07fd2f2.tar.gz coinos-server-193457c5bd6c7c892c3be50674579dabd07fd2f2.zip | |
use redis to store rates
Diffstat (limited to 'lib/invoices.js')
| -rw-r--r-- | lib/invoices.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/invoices.js b/lib/invoices.js index 557d0de6..2f1225e7 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -37,8 +37,9 @@ export let generate = async ({ invoice, user, sender }) => { else if (sender) user = await getUser(sender.username); if (!user) fail("user not provided"); + let rates = await g('rates'); if (!currency) currency = user.currency; - if (!rate) rate = store.rates[currency]; + if (!rate) rate = rates[currency]; if (fiat) amount = Math.round((SATS * fiat) / rate); if (amount < 0) fail("invalid amount"); if (tip < 0) fail("invalid tip"); |
