Revert "Added checkpoints with the new code from ChainPad"

This reverts commit da2bfe2de9.
This commit is contained in:
ansuz
2016-05-30 10:20:08 +02:00
parent 599f5aeec8
commit 6e2e8bf21f
3 changed files with 164 additions and 264 deletions

View File

@@ -87,27 +87,7 @@ dropUser = function (ctx, user) {
};
const getHistory = function (ctx, channelName, handler, cb) {
var messageBuf = [];
ctx.store.getMessages(channelName, function (msgStr) {
messageBuf.push(JSON.parse(msgStr));
}, function () {
var startPoint;
var cpCount = 0;
var msgBuff2 = [];
for (startPoint = messageBuf.length - 1; startPoint >= 0; startPoint--) {
var msg = messageBuf[startPoint];
msgBuff2.push(msg);
if (msg[2] === 'MSG' && msg[4].indexOf('cp|') === 0) {
cpCount++;
if (cpCount >= 2) {
for (var x = msgBuff2.pop(); x; x = msgBuff2.pop()) { handler(x); }
break;
}
}
//console.log(messageBuf[startPoint]);
}
cb();
});
ctx.store.getMessages(channelName, function (msgStr) { handler(JSON.parse(msgStr)); }, cb);
};
const randName = function () { return Crypto.randomBytes(16).toString('hex'); };