Fix issues with trim history in spreadsheets

This commit is contained in:
yflory
2020-03-23 12:32:03 +01:00
parent a13561eb8d
commit 8e8b371690
5 changed files with 26 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ define([
return void cb();
}
var txid = Math.floor(Math.random() * 1000000);
var onOpen = function (wc) {
ctx.channels[channel] = ctx.channels[channel] || {
@@ -91,6 +92,7 @@ define([
var hk = network.historyKeeper;
var cfg = {
txid: txid,
lastKnownHash: chan.lastKnownHash || chan.lastCpHash,
metadata: {
validateKey: obj.validateKey,
@@ -121,6 +123,8 @@ define([
} catch (e) {}
if (!parsed) { return; }
// If there is a txid, make sure it's ours or abort
if (parsed.txid && parsed.txid !== txid) { return; }
// Keep only metadata messages for the current channel
if (parsed.channel && parsed.channel !== channel) { return; }
@@ -138,6 +142,11 @@ define([
}
if (parsed.error && parsed.channel) { return; }
// If there is a txid, make sure it's ours or abort
if (Array.isArray(parsed) && parsed[0] && parsed[0] !== txid) {
return;
}
msg = parsed[4];
// Keep only the history for our channel