Make service worker skips empty states and public fields
This commit is contained in:
parent
c82c219a28
commit
57bd945599
@ -1,3 +1,5 @@
|
|||||||
|
const EMPTY32BYTES = String('').padStart(64, '0');
|
||||||
|
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
event.waitUntil(self.skipWaiting()); // Activate worker immediately
|
event.waitUntil(self.skipWaiting()); // Activate worker immediately
|
||||||
});
|
});
|
||||||
@ -58,9 +60,11 @@ async function scanMissingData(processesToScan) {
|
|||||||
const firstState = process.states[0];
|
const firstState = process.states[0];
|
||||||
const processId = firstState.commited_in;
|
const processId = firstState.commited_in;
|
||||||
for (const state of process.states) {
|
for (const state of process.states) {
|
||||||
if (!state.pcd_commitment) continue;
|
if (state.state_id === EMPTY32BYTES) continue;
|
||||||
// iterate on pcd_commitment
|
// iterate on pcd_commitment
|
||||||
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
|
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
|
||||||
|
// Skip public fields
|
||||||
|
if (state.public_data[field] || field === 'roles') continue;
|
||||||
// Check if we have the data in db
|
// Check if we have the data in db
|
||||||
const existingData = await getBlob(hash);
|
const existingData = await getBlob(hash);
|
||||||
if (!existingData) {
|
if (!existingData) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user