orphan fork and notfound.

This commit is contained in:
Christopher Jeffrey 2016-05-06 23:10:31 -07:00
parent f11f4091f5
commit 9b2d80098a
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 3 additions and 4 deletions

View File

@ -1376,16 +1376,12 @@ Chain.prototype.add = function add(block, callback, force) {
// If the orphan chain forked, simply
// reset the orphans.
if (orphan.hash('hex') !== hash) {
self.purgeOrphans();
self.emit('fork', block, {
height: block.getCoinbaseHeight(),
expected: orphan.hash('hex'),
received: hash,
checkpoint: false
});
return done(new VerifyError(block, 'duplicate', 'duplicate', 0));
}
self.emit('orphan', block, {

View File

@ -611,6 +611,9 @@ Peer.prototype._onPacket = function onPacket(packet) {
case 'verack':
this._emit(cmd, payload);
break;
case 'notfound':
this._emit(cmd, payload);
break;
default:
bcoin.debug('Unknown packet: %s', cmd);
this._emit(cmd, payload);