fixes and cleanup.
This commit is contained in:
parent
34ecf9b318
commit
2feef87331
@ -1236,7 +1236,7 @@ Chain.prototype.setBestChain = function setBestChain(entry, block, prev, callbac
|
|||||||
|
|
||||||
// A higher fork has arrived.
|
// A higher fork has arrived.
|
||||||
// Time to reorganize the chain.
|
// Time to reorganize the chain.
|
||||||
self.logger.warning('WARNING: Reorganizing chain.');
|
this.logger.warning('WARNING: Reorganizing chain.');
|
||||||
return this.reorganize(entry, block, done);
|
return this.reorganize(entry, block, done);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -848,7 +848,7 @@ ChainDB.prototype.connectBlock = function connectBlock(block, view, batch, callb
|
|||||||
|
|
||||||
for (i = 0; i < block.txs.length; i++) {
|
for (i = 0; i < block.txs.length; i++) {
|
||||||
tx = block.txs[i];
|
tx = block.txs[i];
|
||||||
hash = tx.hash('hex');
|
hash = tx.hash();
|
||||||
|
|
||||||
if (this.options.indexTX) {
|
if (this.options.indexTX) {
|
||||||
batch.put(layout.t(hash), tx.toExtended());
|
batch.put(layout.t(hash), tx.toExtended());
|
||||||
|
|||||||
@ -48,20 +48,30 @@ function Coins(options) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Coins.prototype.fromOptions = function fromOptions(options) {
|
Coins.prototype.fromOptions = function fromOptions(options) {
|
||||||
if (options.version != null)
|
if (options.version != null) {
|
||||||
|
assert(utils.isNumber(options.version));
|
||||||
this.version = options.version;
|
this.version = options.version;
|
||||||
|
}
|
||||||
|
|
||||||
if (options.hash)
|
if (options.hash) {
|
||||||
|
assert(typeof options.hash === 'string');
|
||||||
this.hash = options.hash;
|
this.hash = options.hash;
|
||||||
|
}
|
||||||
|
|
||||||
if (options.height != null)
|
if (options.height != null) {
|
||||||
|
assert(utils.isNumber(options.height));
|
||||||
this.height = options.height;
|
this.height = options.height;
|
||||||
|
}
|
||||||
|
|
||||||
if (options.coinbase != null)
|
if (options.coinbase != null) {
|
||||||
|
assert(typeof options.coinbase === 'boolean');
|
||||||
this.coinbase = options.coinbase;
|
this.coinbase = options.coinbase;
|
||||||
|
}
|
||||||
|
|
||||||
if (options.outputs)
|
if (options.outputs) {
|
||||||
|
assert(Array.isArray(options.outputs));
|
||||||
this.outputs = options.outputs;
|
this.outputs = options.outputs;
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -51,8 +51,6 @@ Outpoint.prototype.fromOptions = function fromOptions(options) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Outpoint.fromOptions = function fromOptions(options) {
|
Outpoint.fromOptions = function fromOptions(options) {
|
||||||
if (options instanceof Outpoint)
|
|
||||||
return options;
|
|
||||||
return new Outpoint().fromOptions(options);
|
return new Outpoint().fromOptions(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,7 +61,7 @@ Outpoint.fromOptions = function fromOptions(options) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Outpoint.prototype.isNull = function isNull() {
|
Outpoint.prototype.isNull = function isNull() {
|
||||||
return this.hash === constants.NULL_HASH && this.index === 0xffffffff;
|
return this.index === 0xffffffff && this.hash === constants.NULL_HASH;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +174,7 @@ Outpoint.fromTX = function fromTX(tx, index) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Outpoint.prototype.inspect = function inspect() {
|
Outpoint.prototype.inspect = function inspect() {
|
||||||
return '<Outpoint: ' + this.hash + '/' + this.index + '>';
|
return '<Outpoint: ' + utils.revHex(this.hash) + '/' + this.index + '>';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user