mark reorganized invalid blocks as invalid.

This commit is contained in:
Christopher Jeffrey 2016-04-16 20:53:47 -07:00
parent 1c1c34e6a4
commit 5909b813cc
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1058,8 +1058,18 @@ Chain.prototype.connect = function connect(entry, callback) {
assert(prev);
self._verifyContext(block, prev, function(err) {
if (err)
if (err) {
if (err.type === 'VerifyError') {
self.invalid[entry.hash] = true;
self.emit('invalid', block, {
height: entry.height,
hash: entry.hash,
seen: false,
chain: false
});
}
return callback(err);
}
self.db.connect(entry, block, function(err) {
if (err)