diff --git a/lib/bcoin/blockdb.js b/lib/bcoin/blockdb.js index 9e0e7f3e..1e8ffe37 100644 --- a/lib/bcoin/blockdb.js +++ b/lib/bcoin/blockdb.js @@ -526,9 +526,9 @@ BlockDB.prototype.getCoinsByAddress = function getCoinsByAddress(addresses, opti if (!key) return done(); - parts = key.split('/').slice(3); - hash = parts[0]; - index = +parts[1]; + parts = key.split('/'); + hash = parts[3]; + index = +parts[4]; record = self.parseOffset(value); self.data.getAsync(record.size, record.offset, function(err, data) { @@ -648,7 +648,7 @@ BlockDB.prototype.getTXByAddress = function getTXByAddress(addresses, options, c (function next() { iter.next(function(err, key, value) { - var record, parts, hash, index; + var record, hash, index; if (err) { return iter.end(function() { @@ -660,8 +660,7 @@ BlockDB.prototype.getTXByAddress = function getTXByAddress(addresses, options, c if (!key) return done(); - parts = key.split('/').slice(3); - hash = parts[0]; + hash = key.split('/')[3]; record = self.parseOffset(value); if (addresses.length > 1) { @@ -968,7 +967,7 @@ BlockDB.prototype.getHeight = function getHeight(callback) { (function next() { iter.next(function(err, key, value) { - var parts, height; + var height; if (err) { return iter.end(function() { @@ -980,8 +979,7 @@ BlockDB.prototype.getHeight = function getHeight(callback) { if (!key) return callback(null, maxHeight); - parts = key.split('/').slice(2); - height = +parts[0]; + height = +key.split('/')[2]; if (height > maxHeight) maxHeight = height;