From f7e54dbc88a625286e848780d7a220a56a314d2f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 4 Aug 2021 17:08:25 -0700 Subject: don't wait for webhook to complete --- routes/assets.js | 11 ++++++++++- routes/bitcoin/receive.js | 4 ++-- routes/lightning/receive.js | 2 +- routes/liquid/receive.js | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/routes/assets.js b/routes/assets.js index fe667dd9..939eb76c 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -111,7 +111,15 @@ app.post( if (filename) contract.filename = filename; - l.info("attempting issuance", req.user.username, contract, "address", address, "pubkey", pubkey); + l.info( + "attempting issuance", + req.user.username, + contract, + "address", + address, + "pubkey", + pubkey + ); sha256.update(JSON.stringify(contract)); const hash = sha256.digest("hex"); @@ -128,6 +136,7 @@ app.post( contract_hash }; + params.asset_amount = asset_amount / (SATS / 10 ** precision); if (token_amount) { diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index d782627d..67ccdb45 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -114,7 +114,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => { emit(user.username, "payment", payment); l.info("bitcoin detected", user.username, value); notify(user, `${value} SAT payment detected`); - await callWebhook(invoice, payment); + callWebhook(invoice, payment); } } catch (e) { console.log(e); @@ -189,7 +189,7 @@ setInterval(async () => { emit(user.username, "payment", p); l.info("bitcoin confirmed", user.username, p.amount, p.tip); notify(user, `${total} SAT payment confirmed`); - await callWebhook(p.invoice, p); + callWebhook(p.invoice, p); } else { l.warn("couldn't find bitcoin payment", hash); } diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js index 32c54de6..0e98cd93 100644 --- a/routes/lightning/receive.js +++ b/routes/lightning/receive.js @@ -69,7 +69,7 @@ const handlePayment = async msg => { payment = payment.get({ plain: true }); payment.account = account.get({ plain: true }); - await callWebhook(invoice, payment); + callWebhook(invoice, payment); emit(user.username, "payment", payment); emit(user.username, "account", payment.account); diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index c377a6b5..3a6aab10 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -175,7 +175,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => { emit(user.username, "account", payment.account); l.info("liquid detected", address, user.username, asset, value); notify(user, `${value} SAT payment detected`); - await callWebhook(invoice, payment); + callWebhook(invoice, payment); }); } } catch (e) { -- cgit v1.2.3