Return Transaction Errors from RPC

This commit is contained in:
Sky Young 2018-08-06 15:45:28 -07:00
parent 2d5bfb45e2
commit dea7e6042f
2 changed files with 13 additions and 8 deletions

View File

@ -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();
};

View File

@ -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;
}