Fix issues with deprecated cache

pull/1/head
yflory 4 years ago
parent 25a5783fb3
commit 34284fcc0c

@ -438,13 +438,12 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => {
to reconcile their differences. */
}
// If our lastKnownHash is older than the 2nd to last checkpoint,
// only send the last 2 checkpoints and ignore "lkh"
// XXX XXX this is probably wrong! ChainPad may not accept checkpoints that are not connected to root
// XXX We probably need to send an EUNKNOWN here so that the client can recreate a new chainpad
/*if (lkh && index.cpIndex.length >= 2 && lkh < index.cpIndex[0].offset) {
return void cb(null, index.cpIndex[0].offset);
}*/
// If our lastKnownHash is older than the 2nd to last checkpoint, send
// EUNKNOWN to tell the user to empty their cache
if (lkh && index.cpIndex.length >= 2 && lkh < index.cpIndex[0].offset) {
waitFor.abort();
return void cb(new Error('EUNKNOWN'));
}
// Otherwise use our lastKnownHash
cb(null, lkh);

Loading…
Cancel
Save