cleanup getTx.

This commit is contained in:
Christopher Jeffrey 2014-12-09 10:02:34 -08:00
parent add618c1e5
commit b4a96d709e

View File

@ -411,28 +411,6 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
if (err) return callback(err);
return callback(null, bitcoin.tx(tx));
});
if (blockhash && typeof blockhash === 'string') {
return bitcoindjs.getTransaction(txid, blockhash, function(err, tx) {
if (err) return callback(err);
if (tx.blockhash) {
bitcoin.db.set('tx-block/' + txid,
{ hash: tx.blockhash }, utils.NOOP);
}
return callback(null, bitcoin.tx(tx));
});
}
return bitcoin.db.get('tx-block/' + txid, function(err, block) {
return bitcoinjs.getTransaction(txid, block ? block.hash : '', function(err, tx) {
if (err) return callback(err);
if (!block && tx.blockhash) {
bitcoin.db.set('tx-block/' + txid,
{ hash: tx.blockhash }, utils.NOOP);
}
return callback(null, bitcoin.tx(tx));
});
});
};
Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback) {