minor.
This commit is contained in:
parent
cdfe7b6ec5
commit
9b266c6ec7
@ -543,7 +543,7 @@ Chain.prototype.locatorHashes = function locatorHashes(start) {
|
|||||||
top = start;
|
top = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(this.db.get(top));
|
assert(this.db.has(top));
|
||||||
|
|
||||||
i = top;
|
i = top;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -553,7 +553,7 @@ Chain.prototype.locatorHashes = function locatorHashes(start) {
|
|||||||
i = i - step;
|
i = i - step;
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
if (i + step !== 0)
|
if (i + step !== 0)
|
||||||
hashes.push(this.db.get(0).hash);
|
hashes.push(network.genesis.hash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (hashes.length >= 10)
|
if (hashes.length >= 10)
|
||||||
@ -999,6 +999,20 @@ ChainDB.prototype.isNull = function isNull(height) {
|
|||||||
return utils.read32(data, 0) === 0;
|
return utils.read32(data, 0) === 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ChainDB.prototype.has = function has(height) {
|
||||||
|
var data;
|
||||||
|
|
||||||
|
if (this._queue[height] || this._cache[height])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
data = this._readSync(4, height * BLOCK_SIZE);
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return utils.read32(data, 0) !== 0;
|
||||||
|
};
|
||||||
|
|
||||||
ChainDB.prototype._readSync = function _readSync(size, offset) {
|
ChainDB.prototype._readSync = function _readSync(size, offset) {
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var data, bytes;
|
var data, bytes;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user