cleanup getTx.
This commit is contained in:
parent
add618c1e5
commit
b4a96d709e
@ -411,28 +411,6 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
|
|||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
return callback(null, bitcoin.tx(tx));
|
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) {
|
Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user