From b413cb204fb98eb7cf853d4ac8d5f69b9c7a0b39 Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Sat, 24 Jul 2021 18:36:01 -0700 Subject: [PATCH] RAD needs to pass cache misses. --- gun.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gun.js b/gun.js index 6979a0d3..7f45f2b8 100644 --- a/gun.js +++ b/gun.js @@ -344,7 +344,7 @@ ++ni; kl = null; pop(o); }()); } Gun.on.put = put; - console.log("BEWARE: BETA VERSION OF NEW GUN! NOT ALL FEATURES FINISHED!"); // clock below, reconnect sync. + console.log("BEWARE: BETA VERSION OF NEW GUN! NOT ALL FEATURES FINISHED!"); // clock below, reconnect sync. // msg put, put, say ack, hear loop... function ham(val, key, soul, state, msg){ var ctx = msg._||'', root = ctx.root, graph = root.graph, lot, tmp; var vertex = graph[soul] || empty, was = state_is(vertex, key, 1), known = vertex[key]; @@ -358,8 +358,8 @@ return; } if(state < was){ /*old;*/ if(!ctx.miss){ return } } // but some chains have a cache miss that need to re-fire. // TODO: Improve in future. // for AXE this would reduce rebroadcast, but GUN does it on message forwarding. - if(!ctx.faith){ // TODO: BUG? Can this be used for cache miss as well? - if(state === was && (val === known || L(val) <= L(known))){ /*console.log("same");*/ /*same;*/ return } // same + if(!ctx.faith){ // TODO: BUG? Can this be used for cache miss as well? // Yes this was a bug, need to check cache miss for RAD tests, but should we care about the faith check now? Probably not. + if(state === was && (val === known || L(val) <= L(known))){ /*console.log("same");*/ /*same;*/ if(!ctx.miss){ return } } // same } ctx.stun++; // TODO: 'forget' feature in SEA tied to this, bad approach, but hacked in for now. Any changes here must update there. var aid = msg['#']+ctx.all++, id = {toString: function(){ return aid }, _: ctx}; // this *trick* makes it compatible between old & new versions.