optimize more.
This commit is contained in:
parent
96bb12568e
commit
f586837013
@ -526,9 +526,9 @@ BlockDB.prototype.getCoinsByAddress = function getCoinsByAddress(addresses, opti
|
|||||||
if (!key)
|
if (!key)
|
||||||
return done();
|
return done();
|
||||||
|
|
||||||
parts = key.split('/').slice(3);
|
parts = key.split('/');
|
||||||
hash = parts[0];
|
hash = parts[3];
|
||||||
index = +parts[1];
|
index = +parts[4];
|
||||||
record = self.parseOffset(value);
|
record = self.parseOffset(value);
|
||||||
|
|
||||||
self.data.getAsync(record.size, record.offset, function(err, data) {
|
self.data.getAsync(record.size, record.offset, function(err, data) {
|
||||||
@ -648,7 +648,7 @@ BlockDB.prototype.getTXByAddress = function getTXByAddress(addresses, options, c
|
|||||||
|
|
||||||
(function next() {
|
(function next() {
|
||||||
iter.next(function(err, key, value) {
|
iter.next(function(err, key, value) {
|
||||||
var record, parts, hash, index;
|
var record, hash, index;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return iter.end(function() {
|
return iter.end(function() {
|
||||||
@ -660,8 +660,7 @@ BlockDB.prototype.getTXByAddress = function getTXByAddress(addresses, options, c
|
|||||||
if (!key)
|
if (!key)
|
||||||
return done();
|
return done();
|
||||||
|
|
||||||
parts = key.split('/').slice(3);
|
hash = key.split('/')[3];
|
||||||
hash = parts[0];
|
|
||||||
record = self.parseOffset(value);
|
record = self.parseOffset(value);
|
||||||
|
|
||||||
if (addresses.length > 1) {
|
if (addresses.length > 1) {
|
||||||
@ -968,7 +967,7 @@ BlockDB.prototype.getHeight = function getHeight(callback) {
|
|||||||
|
|
||||||
(function next() {
|
(function next() {
|
||||||
iter.next(function(err, key, value) {
|
iter.next(function(err, key, value) {
|
||||||
var parts, height;
|
var height;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return iter.end(function() {
|
return iter.end(function() {
|
||||||
@ -980,8 +979,7 @@ BlockDB.prototype.getHeight = function getHeight(callback) {
|
|||||||
if (!key)
|
if (!key)
|
||||||
return callback(null, maxHeight);
|
return callback(null, maxHeight);
|
||||||
|
|
||||||
parts = key.split('/').slice(2);
|
height = +key.split('/')[2];
|
||||||
height = +parts[0];
|
|
||||||
if (height > maxHeight)
|
if (height > maxHeight)
|
||||||
maxHeight = height;
|
maxHeight = height;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user