From 6d9bbad052d2ac36c812d209452d8a33c2b52a69 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 20 Jan 2018 16:25:26 +0300 Subject: [PATCH] create tx spv verification param fix --- routes/shepherd/electrum/createtx.js | 55 +++++++++++++++------------- version | 6 +-- version_build | 2 +- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/routes/shepherd/electrum/createtx.js b/routes/shepherd/electrum/createtx.js index 62b4e49..e264a6f 100644 --- a/routes/shepherd/electrum/createtx.js +++ b/routes/shepherd/electrum/createtx.js @@ -206,7 +206,7 @@ module.exports = (shepherd) => { shepherd.log('electrum createrawtx =>', true); ecl.connect(); - shepherd.listunspent(ecl, changeAddress, network, true, true) + shepherd.listunspent(ecl, changeAddress, network, true, req.query.verify === 'true' ? true : null) .then((utxoList) => { ecl.close(); @@ -395,27 +395,29 @@ module.exports = (shepherd) => { value ); } else { - if (network === 'btg' || - network === 'bch') { - _rawtx = shepherd.buildSignedTxForks( - outputAddress, - changeAddress, - wif, - network, - inputs, - _change, - value - ); - } else { - _rawtx = shepherd.buildSignedTx( - outputAddress, - changeAddress, - wif, - network, - inputs, - _change, - value - ); + if (!req.query.offline) { + if (network === 'btg' || + network === 'bch') { + _rawtx = shepherd.buildSignedTxForks( + outputAddress, + changeAddress, + wif, + network, + inputs, + _change, + value + ); + } else { + _rawtx = shepherd.buildSignedTx( + outputAddress, + changeAddress, + wif, + network, + inputs, + _change, + value + ); + } } } @@ -586,10 +588,11 @@ module.exports = (shepherd) => { } }); - shepherd.get('/electrum/pushtx', (req, res, next) => { - if (shepherd.checkToken(req.query.token)) { - const rawtx = req.query.rawtx; - const ecl = new shepherd.electrumJSCore(shepherd.electrumServers[req.query.network].port, shepherd.electrumServers[req.query.network].address, shepherd.electrumServers[req.query.network].proto); // tcp or tls + shepherd.post('/electrum/pushtx', (req, res, next) => { + if (shepherd.checkToken(req.body.token)) { + const rawtx = req.body.rawtx; + const _network = req.body.network; + const ecl = new shepherd.electrumJSCore(shepherd.electrumServers[_network].port, shepherd.electrumServers[_network].address, shepherd.electrumServers[_network].proto); // tcp or tls ecl.connect(); ecl.blockchainTransactionBroadcast(rawtx) diff --git a/version b/version index 3615aad..fc947fe 100644 --- a/version +++ b/version @@ -1,3 +1,3 @@ -version=0.2.0.26d -type=d-beta -minversion=0.2.0.26 \ No newline at end of file +version=0.2.0.27a +type=a-beta +minversion=0.2.0.27 \ No newline at end of file diff --git a/version_build b/version_build index 3aa3528..a8ffa87 100644 --- a/version_build +++ b/version_build @@ -1 +1 @@ -0.2.0.26d-beta \ No newline at end of file +0.2.0.27a-beta \ No newline at end of file