From dea7e6042f5b6c46e5746b8eedb26cb10e01ea1f Mon Sep 17 00:00:00 2001 From: Sky Young Date: Mon, 6 Aug 2018 15:45:28 -0700 Subject: [PATCH] Return Transaction Errors from RPC --- lib/http/rpc.js | 7 ++++++- lib/node/fullnode.js | 14 +++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/http/rpc.js b/lib/http/rpc.js index 30fafd90..c3f3e544 100644 --- a/lib/http/rpc.js +++ b/lib/http/rpc.js @@ -1788,7 +1788,12 @@ RPC.prototype.sendRawTransaction = async function sendRawTransaction(args, help) const tx = TX.fromRaw(data); - this.node.relay(tx); + var response + try { + response = await this.node.sendTX(tx); + } catch(e) { + throw e + } return tx.txid(); }; diff --git a/lib/node/fullnode.js b/lib/node/fullnode.js index 7d07755d..0cad4e8d 100644 --- a/lib/node/fullnode.js +++ b/lib/node/fullnode.js @@ -298,13 +298,13 @@ FullNode.prototype.sendTX = async function sendTX(tx) { try { missing = await this.mempool.addTX(tx); } catch (err) { - if (err.type === 'VerifyError' && err.score === 0) { - this.error(err); - this.logger.warning('Verification failed for tx: %s.', tx.txid()); - this.logger.warning('Attempting to broadcast anyway...'); - this.broadcast(tx); - return; - } + // if (err.type === 'VerifyError' && err.score === 0) { + // this.error(err); + // this.logger.warning('Verification failed for tx: %s.', tx.txid()); + // this.logger.warning('Attempting to broadcast anyway...'); + // this.broadcast(tx); + // return; + // } throw err; }