|
|
|
@ -357,7 +357,7 @@ const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) {
|
|
|
|
|
if (offsetCount < 0) {
|
|
|
|
|
Log.warn('OFFSET_TRIM_OOO', {
|
|
|
|
|
channel: id,
|
|
|
|
|
map: index.OffsetByHash
|
|
|
|
|
map: index.offsetByHash
|
|
|
|
|
});
|
|
|
|
|
} else if (offsetCount > 0) {
|
|
|
|
|
trimOffsetByOrder(index.offsetByHash, index.offsets);
|
|
|
|
@ -445,6 +445,14 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => {
|
|
|
|
|
return void cb(new Error('EUNKNOWN'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we asked for a lastKnownHash but didn't find it AND if
|
|
|
|
|
// this channel has checkpoints, send EUNKNOWN so that the
|
|
|
|
|
// client can ask for normal history (without lastKnownHash)
|
|
|
|
|
if (lastKnownHash && !lkh && index.cpIndex.length) {
|
|
|
|
|
waitFor.abort();
|
|
|
|
|
return void cb(new Error('EUNKNOWN'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Otherwise use our lastKnownHash
|
|
|
|
|
cb(null, lkh);
|
|
|
|
|
}));
|
|
|
|
|