This commit is contained in:
Caleb James DeLisle
2016-03-25 16:49:27 +01:00
parent 62eabbc7ae
commit 98c85cef8b
3 changed files with 4 additions and 7 deletions

View File

@@ -1033,13 +1033,13 @@ var handleMessage = ChainPad.handleMessage = function (realtime, msgStr) {
// toApply.length-1 because we do not want to apply the new patch.
for (var i = 0; i < toApply.length-1; i++) {
if (Common.PARANOIA) {
Common.assert(Sha.hex_sha256(authDocAtTimeOfPatch) === toApply[i].content.parentHash);
}
if (typeof(toApply[i].content.inverseOf) === 'undefined') {
toApply[i].content.inverseOf = Patch.invert(toApply[i].content, authDocAtTimeOfPatch);
toApply[i].content.inverseOf.inverseOf = toApply[i].content;
}
if (Common.PARANOIA) {
Common.assert(Sha.hex_sha256(authDocAtTimeOfPatch) === toApply[i].content.parentHash);
}
authDocAtTimeOfPatch = Patch.apply(toApply[i].content, authDocAtTimeOfPatch);
}