no db caching for now.
This commit is contained in:
parent
40da6fe0ae
commit
c4f204dfa8
|
@ -388,10 +388,12 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
|
|||
blockhash = options.blockhash || options.block;
|
||||
traverse = options.traverse !== false;
|
||||
}
|
||||
|
||||
if (typeof blockhash === 'function') {
|
||||
callback = blockhash;
|
||||
blockhash = '';
|
||||
}
|
||||
|
||||
if (typeof blockhash !== 'string') {
|
||||
if (blockhash) {
|
||||
blockhash = blockhash.hash
|
||||
|
@ -402,6 +404,12 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
|
|||
blockhash = '';
|
||||
}
|
||||
}
|
||||
|
||||
return bitcoindjs.getTransaction(txid, blockhash, traverse, function(err, tx) {
|
||||
if (err) return callback(err);
|
||||
return callback(null, bitcoin.tx(tx));
|
||||
});
|
||||
|
||||
if (blockhash && typeof blockhash === 'string') {
|
||||
return bitcoindjs.getTransaction(txid, blockhash, traverse, function(err, tx) {
|
||||
if (err) return callback(err);
|
||||
|
@ -412,6 +420,7 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
|
|||
return callback(null, bitcoin.tx(tx));
|
||||
});
|
||||
}
|
||||
|
||||
return bitcoin.db.get('tx-block/' + txid, function(err, block) {
|
||||
// Will traverse blockchain if no block - slow:
|
||||
return bitcoinjs.getTransaction(txid, block ? block.hash : '', traverse, function(err, tx) {
|
||||
|
|
Loading…
Reference in New Issue