make use of getBlockByTx caching.
This commit is contained in:
parent
00777ef855
commit
4a5ae622d1
|
@ -421,6 +421,8 @@ Bitcoin.prototype.getTx = function(txid, blockhash, callback) {
|
||||||
|
|
||||||
Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback) {
|
Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback) {
|
||||||
if (bitcoin.stopping) return;
|
if (bitcoin.stopping) return;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
var slow = true;
|
var slow = true;
|
||||||
|
|
||||||
if (typeof txid === 'object' && txid) {
|
if (typeof txid === 'object' && txid) {
|
||||||
|
@ -451,9 +453,9 @@ Bitcoin.prototype.getTransactionWithBlock = function(txid, blockhash, callback)
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
|
|
||||||
if (slow && !tx.blockhash) {
|
if (slow && !tx.blockhash) {
|
||||||
return bitcoindjs.getBlockByTx(txid, function(err, block, tx_) {
|
return self.getBlockByTx(txid, function(err, block, tx_) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
return callback(null, bitcoin.tx(tx), bitcoin.block(block));
|
return callback(null, tx, block);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue