comments.
This commit is contained in:
parent
496b922f18
commit
bbec33591d
@ -2095,7 +2095,7 @@ Chain.prototype.retarget = function retarget(prev, first) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a locator. Analagous to bitcoind's `FindForkInMainChain()`.
|
* Find a locator. Analagous to bitcoind's `FindForkInGlobalIndex()`.
|
||||||
* @param {Hash[]} locator - Hashes.
|
* @param {Hash[]} locator - Hashes.
|
||||||
* @param {Function} callback - Returns [Error, {@link Hash}] (the
|
* @param {Function} callback - Returns [Error, {@link Hash}] (the
|
||||||
* hash of the latest known block).
|
* hash of the latest known block).
|
||||||
|
|||||||
@ -1222,11 +1222,14 @@ Peer.prototype._handleGetData = function _handleGetData(items) {
|
|||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hit the broadcast queue first.
|
||||||
for (i = 0; i < items.length; i++) {
|
for (i = 0; i < items.length; i++) {
|
||||||
item = items[i];
|
item = items[i];
|
||||||
entry = this.pool.inv.map[item.hash];
|
entry = this.pool.inv.map[item.hash];
|
||||||
witness = (item.type & constants.WITNESS_MASK) !== 0;
|
witness = (item.type & constants.WITNESS_MASK) !== 0;
|
||||||
|
|
||||||
|
// If the item isn't present, queue it up
|
||||||
|
// to be checked in the mempool or chain.
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
check.push(item);
|
check.push(item);
|
||||||
continue;
|
continue;
|
||||||
@ -1246,6 +1249,10 @@ Peer.prototype._handleGetData = function _handleGetData(items) {
|
|||||||
witness ? 'witness' : 'normal',
|
witness ? 'witness' : 'normal',
|
||||||
this.hostname);
|
this.hostname);
|
||||||
|
|
||||||
|
// Try to send the data.
|
||||||
|
// If the item was announce-only (i.e. the data
|
||||||
|
// isn't actually contained in the broadcast
|
||||||
|
// item), check this on the mempool/chain.
|
||||||
if (!entry.send(this, witness))
|
if (!entry.send(this, witness))
|
||||||
check.push(item);
|
check.push(item);
|
||||||
}
|
}
|
||||||
@ -1253,6 +1260,8 @@ Peer.prototype._handleGetData = function _handleGetData(items) {
|
|||||||
if (this.pool.options.selfish)
|
if (this.pool.options.selfish)
|
||||||
return done();
|
return done();
|
||||||
|
|
||||||
|
// Item wasn't found in broadcast queue.
|
||||||
|
// Check the mempool and chain.
|
||||||
utils.forEachSerial(check, function(item, next) {
|
utils.forEachSerial(check, function(item, next) {
|
||||||
var type = item.type & ~constants.WITNESS_MASK;
|
var type = item.type & ~constants.WITNESS_MASK;
|
||||||
var witness = (item.type & constants.WITNESS_MASK) !== 0;
|
var witness = (item.type & constants.WITNESS_MASK) !== 0;
|
||||||
|
|||||||
@ -2254,6 +2254,8 @@ BroadcastItem.prototype.send = function send(peer, witness) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.type === constants.inv.TX) {
|
if (this.type === constants.inv.TX) {
|
||||||
|
// Failsafe - we never want to relay coinbases.
|
||||||
|
// They are an insta-ban from any bitcoind node.
|
||||||
if (this.msg.isCoinbase()) {
|
if (this.msg.isCoinbase()) {
|
||||||
peer.write(peer.framer.notFound([this]));
|
peer.write(peer.framer.notFound([this]));
|
||||||
bcoin.debug('Failsafe: tried to relay a coinbase.');
|
bcoin.debug('Failsafe: tried to relay a coinbase.');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user