fix verifyContext.

This commit is contained in:
Christopher Jeffrey 2016-02-16 14:08:56 -08:00
parent fe46d1ada5
commit 02e4c9e266

View File

@ -670,7 +670,7 @@ Chain.prototype.add = function add(block, peer, callback) {
var self = this;
var initial = block;
var code = Chain.codes.unchanged;
var hash, prevHash, prevHeight, entry, tip, existing, checkpoint;
var hash, prevHash, prevHeight, entry, tip, existing, checkpoint, prev;
var total = 0;
callback = utils.asyncify(callback);
@ -815,11 +815,14 @@ Chain.prototype.add = function add(block, peer, callback) {
}
}
// self._verifyContext(block, prev, function(err, verified) {
// Lookup previous entry.
prev = self.db.get(prevHeight);
assert(prev);
// Do "contextual" verification on our block
// now that we're certain its previous
// block is in the chain.
// self._verifyContext(block, prev, function(err, verified) {
if (!block.verifyContext(prev)) {
code = Chain.codes.invalid;
self.emit('invalid', {