diff --git a/app/lib/dup/indexer.js b/app/lib/dup/indexer.js index 70a67b4314b412824d0f658f9d015a7d00058513..d615d30cb98cf32eb4f3f106bd4ea24c981de854 100644 --- a/app/lib/dup/indexer.js +++ b/app/lib/dup/indexer.js @@ -1523,7 +1523,8 @@ function reduceBy(reducables, properties) { function checkPeopleAreNotOudistanced (pubkeys, newLinks, newcomers, conf, dal) { return co(function *() { - let wotb = dal.wotb; + // let wotb = dal.wotb; + let wotb = dal.wotb.memcopy(); let current = yield dal.getCurrentBlockOrNull(); let membersCount = current ? current.membersCount : 0; // TODO: make a temporary copy of the WoT in RAM @@ -1559,6 +1560,7 @@ function checkPeopleAreNotOudistanced (pubkeys, newLinks, newcomers, conf, dal) // Undo temp links/nodes tempLinks.forEach((link) => wotb.removeLink(link.from, link.to)); newcomers.forEach(() => wotb.removeNode()); + wotb.clear(); return error ? true : false; }); } diff --git a/app/lib/wot.js b/app/lib/wot.js index d2173e31e410a84f13c0c54beee12c7f7944e010..5543c780f44f1a1ae6fde470c8c66b54523652cf 100644 --- a/app/lib/wot.js +++ b/app/lib/wot.js @@ -12,8 +12,13 @@ module.exports = { function WoTBWrapper(instance) { + this.memcopy = () => { + return new WoTBWrapper(instance.memCopy()); + }; + this.setVerbose = wotb.setVerbose; this.resetWoT = instance.resetWoT; + this.clear = instance.clear; this.showWoT = instance.showWoT; this.showGraph = () => instance.showGraph(); diff --git a/package.json b/package.json index c5e46744abbb9048856aa9d672f9bd549472ac5c..e5b5498050ba02472ecb71d5133823721f6e3b60 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "unzip": "0.1.11", "unzip2": "0.2.5", "winston": "2.2.0", - "wotb": "0.4.14" + "wotb": "0.4.15" }, "devDependencies": { "coveralls": "2.11.4",