From babd01948f5e01d326feece425654cb17b6c7d9f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 15 Oct 2019 06:42:51 +0000 Subject: sign after wallet is unlocked --- sendCoins.js | 6 ++---- 1 file 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; -- cgit v1.2.3