node: minor fixes.
This commit is contained in:
parent
1365d0ff1d
commit
dcfc19408f
@ -1725,7 +1725,7 @@ Chain.prototype.hasPending = function hasPending(hash) {
|
|||||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Chain.prototype.getEntry = function getEntry(hash, callback) {
|
Chain.prototype.getEntry = function getEntry(hash) {
|
||||||
return this.db.getEntry(hash);
|
return this.db.getEntry(hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2017,13 +2017,11 @@ Chain.prototype.retarget = function retarget(prev, first) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Chain.prototype.findLocator = co(function* findLocator(locator) {
|
Chain.prototype.findLocator = co(function* findLocator(locator) {
|
||||||
var i, hash, main;
|
var i, hash;
|
||||||
|
|
||||||
for (i = 0; i < locator.length; i++) {
|
for (i = 0; i < locator.length; i++) {
|
||||||
hash = locator[i];
|
hash = locator[i];
|
||||||
main = yield this.db.isMainChain(hash);
|
if (yield this.db.isMainChain(hash))
|
||||||
|
|
||||||
if (main)
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,7 +2031,7 @@ Chain.prototype.findLocator = co(function* findLocator(locator) {
|
|||||||
/**
|
/**
|
||||||
* Check whether a versionbits deployment is active (BIP9: versionbits).
|
* Check whether a versionbits deployment is active (BIP9: versionbits).
|
||||||
* @example
|
* @example
|
||||||
* chain.isActive(entry, 'witness', callback);
|
* yield chain.isActive(tip, deployments.segwit);
|
||||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
||||||
* @param {ChainEntry} prev - Previous chain entry.
|
* @param {ChainEntry} prev - Previous chain entry.
|
||||||
* @param {String} id - Deployment id.
|
* @param {String} id - Deployment id.
|
||||||
@ -2056,7 +2054,7 @@ Chain.prototype.isActive = co(function* isActive(prev, deployment) {
|
|||||||
/**
|
/**
|
||||||
* Get chain entry state for a deployment (BIP9: versionbits).
|
* Get chain entry state for a deployment (BIP9: versionbits).
|
||||||
* @example
|
* @example
|
||||||
* chain.getState(entry, 'witness', callback);
|
* yield chain.getState(tip, deployments.segwit);
|
||||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
||||||
* @param {ChainEntry} prev - Previous chain entry.
|
* @param {ChainEntry} prev - Previous chain entry.
|
||||||
* @param {String} id - Deployment id.
|
* @param {String} id - Deployment id.
|
||||||
|
|||||||
@ -1952,10 +1952,15 @@ RejectPacket.prototype.fromReader = function fromReader(br) {
|
|||||||
this.code = br.readU8();
|
this.code = br.readU8();
|
||||||
this.reason = br.readVarString('ascii', 111);
|
this.reason = br.readVarString('ascii', 111);
|
||||||
|
|
||||||
if (this.message === 'block' || this.message === 'tx')
|
switch (this.message) {
|
||||||
this.hash = br.readHash('hex');
|
case 'block':
|
||||||
else
|
case 'tx':
|
||||||
this.hash = null;
|
this.hash = br.readHash('hex');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.hash = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -307,8 +307,8 @@ FullNode.prototype.scan = function scan(start, filter, iter) {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FullNode.prototype.broadcast = function broadcast(item, callback) {
|
FullNode.prototype.broadcast = function broadcast(item) {
|
||||||
return this.pool.broadcast(item, callback);
|
return this.pool.broadcast(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,10 +334,8 @@ FullNode.prototype.sendTX = co(function* sendTX(tx) {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.selfish)
|
if (this.options.selfish)
|
||||||
tx = tx.toInv();
|
this.pool.announceTX(tx);
|
||||||
|
|
||||||
yield this.pool.broadcast(tx);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user