aboutsummaryrefslogtreecommitdiffstats
path: root/routes/liquid
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-05-13 02:24:05 -0400
committerAdam Soltys <[email protected]>2021-05-13 02:24:05 -0400
commit4d2379b801ed0a95e8538a64873a0be503e74672 (patch)
tree8114688e98443e0ab536e7367eecb2f5d40aafe0 /routes/liquid
parent7d6d6ca74f1f271427c271382fff49446aaa1895 (diff)
downloadcoinos-server-4d2379b801ed0a95e8538a64873a0be503e74672.tar.gz
coinos-server-4d2379b801ed0a95e8538a64873a0be503e74672.zip
confidential to non-confidential liquid conversion
Diffstat (limited to 'routes/liquid')
-rw-r--r--routes/liquid/receive.js18
-rw-r--r--routes/liquid/send.js2
2 files changed, 18 insertions, 2 deletions
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js
index 3ce6ca9a..f6a78cfa 100644
--- a/routes/liquid/receive.js
+++ b/routes/liquid/receive.js
@@ -287,6 +287,7 @@ setInterval(async () => {
for (let i = 0; i < arr.length; i++) {
const hash = arr[i];
+ let account, address, user, total;
await db.transaction(async transaction => {
let p = await db.Payment.findOne({
where: { hash, confirmed: 0, received: 1 },
@@ -304,7 +305,7 @@ setInterval(async () => {
transaction
});
- const { user } = p;
+ ({ account, address, user } = p);
if (p && p.account) {
let total = p.amount + p.tip;
@@ -340,6 +341,21 @@ setInterval(async () => {
delete queue[hash];
});
+
+ let c = convert[address];
+ if (c) {
+ let { tx } = c;
+ user.account = account;
+
+ delete queue[hash];
+
+ await sendLiquid({
+ address,
+ user,
+ tx,
+ limit: total
+ });
+ }
}
} catch (e) {
l.error("problem processing queued liquid transaction", e.message);
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index 0729370c..b80471b0 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -158,6 +158,6 @@ module.exports = ah(async (req, res) => {
res.send(await sendLiquid({ user, address, memo, tx }));
} catch (e) {
l.error("problem sending liquid", user.username, e.message);
- return res.status(500).send(e.message);
+ return res.status(500).send(e);
}
});