aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2019-10-15 06:42:51 +0000
committerAdam Soltys <[email protected]>2019-10-15 06:42:57 +0000
commitbabd01948f5e01d326feece425654cb17b6c7d9f (patch)
tree51f38c1ea61fb1aed5128a1b532d3b2ee76dfe7b
parenta3ae613d7e2cde43096dcd80f8a1e04a7fb2512f (diff)
downloadcoinos-server-babd01948f5e01d326feece425654cb17b6c7d9f.tar.gz
coinos-server-babd01948f5e01d326feece425654cb17b6c7d9f.zip
sign after wallet is unlocked
-rw-r--r--sendCoins.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/sendCoins.js b/sendCoins.js
index 997af0dd..b1456798 100644
--- a/sendCoins.js
+++ b/sendCoins.js
@@ -18,8 +18,6 @@ module.exports = (app, bc, db, emit) => async (req, res) => {
let { hex, fee } = rawtx;
fee = parseInt(fee * SATS);
- rawtx = (await bc.signRawTransactionWithWallet(hex)).hex;
-
l("sending coins", req.user.username, amount, address);
try {
@@ -48,10 +46,10 @@ module.exports = (app, bc, db, emit) => async (req, res) => {
if (config.bitcoin.walletpass)
await bc.walletPassphrase(config.bitcoin.walletpass, 300);
+ rawtx = (await bc.signRawTransactionWithWallet(hex)).hex;
let txid = await bc.sendRawTransaction(rawtx);
- let txhex = await bc.getRawTransaction(txid);
- let tx = bitcoin.Transaction.fromHex(txhex);
+ let tx = bitcoin.Transaction.fromHex(rawtx);
let total = Math.min(amount + fee, req.user.balance);
if (req.user.balance < 0) req.user.balance = 0;