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