From 62eabbc7aef94cbc3d9a4b9b54aa7a8dcf2fe9da Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 25 Mar 2016 15:23:19 +0100 Subject: [PATCH] If a message does not match parent hash, don't delete it from storage --- www/common/chainpad.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index 3dd9382fc..15b5505c6 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -369,7 +369,7 @@ var random = Patch.random = function (doc, opCount) { * along with this program. If not, see . */ -var PARANOIA = module.exports.PARANOIA = true; +var PARANOIA = module.exports.PARANOIA = false; /* throw errors over non-compliant messages which would otherwise be treated as invalid */ var TESTING = module.exports.TESTING = false; @@ -1046,8 +1046,7 @@ var handleMessage = ChainPad.handleMessage = function (realtime, msgStr) { if (Sha.hex_sha256(authDocAtTimeOfPatch) !== patch.parentHash) { debug(realtime, "patch [" + msg.hashOf + "] parentHash is not valid"); if (Common.PARANOIA) { check(realtime); } - if (Common.TESTING) { throw new Error(); } - delete realtime.messages[msg.hashOf]; + //delete realtime.messages[msg.hashOf]; return; }