aboutsummaryrefslogtreecommitdiffstats
path: root/routes/assets.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-08-03 02:11:23 -0700
committerAdam Soltys <[email protected]>2021-08-03 02:11:23 -0700
commit02d8ef89dadfaee37aa058f85082985004acbc0a (patch)
tree57bd1a4079a7b49af753aa81ce5127f533f37b74 /routes/assets.js
parent803998539992b2f0ca07f7ab869750e7b1061dd3 (diff)
parent6abfe155c5bb3845f59775b95eeb9d4034aa92b8 (diff)
downloadcoinos-server-02d8ef89dadfaee37aa058f85082985004acbc0a.tar.gz
coinos-server-02d8ef89dadfaee37aa058f85082985004acbc0a.zip
Merge branch 'taxi'
Diffstat (limited to 'routes/assets.js')
-rw-r--r--routes/assets.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/routes/assets.js b/routes/assets.js
index f99301ae..3f483a28 100644
--- a/routes/assets.js
+++ b/routes/assets.js
@@ -111,7 +111,7 @@ app.post(
if (filename) contract.filename = filename;
- l.info("attempting issuance", req.user.username, contract);
+ l.info("attempting issuance", req.user.username, contract, "address", address, "pubkey", pubkey);
sha256.update(JSON.stringify(contract));
const hash = sha256.digest("hex");
@@ -149,7 +149,7 @@ app.post(
const srt = await lq.signRawTransactionWithWallet(brt);
const allowed = (await lq.testMempoolAccept([srt.hex]))[0].allowed;
fs.writeFileSync('tx', srt.hex);
- if (!allowed) throw new Error();
+ if (!allowed) throw new Error("issuance rejected by mempool");
const txid = await lq.sendRawTransaction(srt.hex);
await db.transaction(async transaction => {
@@ -185,6 +185,7 @@ app.post(
await account.reload({ transaction });
emit(user.username, "account", account);
+ if (address) return;
account = await db.Account.create(
{
asset,
@@ -269,9 +270,9 @@ app.post(
}
});
- res.send(issuances[txid]);
+ res.send(issuances[txid] ? issuances[txid] : { asset });
} catch (e) {
- l.error("asset issuance failed", e.message);
+ l.error("asset issuance failed", e.message, e.stack);
res.status(500).send(e.message);
}
})