small change to chainpad in order to make it more likely to fail if the authDoc goes into the wrong state
This commit is contained in:
parent
f3fb674504
commit
b372b0b77c
@ -1043,12 +1043,18 @@ var handleMessage = ChainPad.handleMessage = function (realtime, msgStr) {
|
||||
authDocAtTimeOfPatch = Patch.apply(toApply[i].content, authDocAtTimeOfPatch);
|
||||
}
|
||||
|
||||
if (Sha.hex_sha256(authDocAtTimeOfPatch) !== patch.parentHash) {
|
||||
var authDocHashAtTimeOfPatch = Sha.hex_sha256(authDocAtTimeOfPatch);
|
||||
if (authDocHashAtTimeOfPatch !== patch.parentHash) {
|
||||
debug(realtime, "patch [" + msg.hashOf + "] parentHash is not valid");
|
||||
if (Common.PARANOIA) { check(realtime); }
|
||||
//delete realtime.messages[msg.hashOf];
|
||||
return;
|
||||
}
|
||||
if (authDocAtTimeOfPatch === realtime.authDoc &&
|
||||
authDocHashAtTimeOfPatch !== realtime.best.inverseOf.parentHash)
|
||||
{
|
||||
throw new Error("authDoc does not match chain head");
|
||||
}
|
||||
|
||||
var simplePatch =
|
||||
Patch.simplify(patch, authDocAtTimeOfPatch, realtime.config.operationSimplify);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user