aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-05-24 16:44:47 -0400
committerAdam Soltys <[email protected]>2021-05-24 16:44:47 -0400
commit205b9ba828922e0ff8d1b47481a569d199d43201 (patch)
tree957d41e2ec8d63ab6dadd21061a87ff2dd84789b
parent3ce9c73b1d4a281fe1475206d49c4f436e0b992e (diff)
downloadcoinos-server-205b9ba828922e0ff8d1b47481a569d199d43201.tar.gz
coinos-server-205b9ba828922e0ff8d1b47481a569d199d43201.zip
check for payment address
-rw-r--r--routes/bitcoin/receive.js15
-rw-r--r--routes/lightning/receive.js2
-rw-r--r--routes/liquid/receive.js2
-rw-r--r--routes/liquid/send.js2
4 files changed, 11 insertions, 10 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 1784fd5f..e76c3664 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -154,8 +154,9 @@ setInterval(async () => {
transaction
});
-
- ({ address, user } = p);
+
+ if (p && p.address) address = p.address;
+ if (p && p.user) user = p.user;
if (p && p.account) {
({ account } = p);
@@ -179,16 +180,16 @@ setInterval(async () => {
l.info("bitcoin confirmed", user.username, p.amount, p.tip);
notify(user, `${total} SAT payment confirmed`);
} else {
- l.warn("couldn't find payment", hash);
+ l.warn("couldn't find bitcoin payment", hash);
}
+
+ delete queue[hash];
});
let c = convert[address];
- if (c) {
+ if (address && c) {
user.account = account;
- delete queue[hash];
-
await sendLiquid({
address: c.address,
amount: total - 100,
@@ -198,6 +199,6 @@ setInterval(async () => {
}
}
} catch (e) {
- l.error("problem processing queued bitcoin transaction", e.message);
+ l.error("problem processing queued bitcoin transaction", e.message, e.stack);
}
}, 1000);
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js
index 6b8a9077..6f7d5fed 100644
--- a/routes/lightning/receive.js
+++ b/routes/lightning/receive.js
@@ -82,7 +82,7 @@ const handlePayment = async msg => {
});
let c = convert[msg.payment_request];
- if (c) {
+ if (msg.payment_request && c) {
user.account = account;
try {
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js
index 14fc8b3d..90ceb39f 100644
--- a/routes/liquid/receive.js
+++ b/routes/liquid/receive.js
@@ -336,7 +336,7 @@ setInterval(async () => {
notify(user, `${total} SAT payment confirmed`);
} else {
- l.warn("couldn't find payment", hash);
+ l.warn("couldn't find liquid payment", hash);
}
delete queue[hash];
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index 55041845..0207baae 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -2,7 +2,7 @@ const btc = config.liquid.btcasset;
const lcad = config.liquid.cadasset;
sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => {
- l.info("sending liquid", amount, user, address);
+ l.info("sending liquid", amount, address);
if (!tx) {
({ tx } = await liquidTx({
address,