Compare commits

..

1 Commits

Author SHA1 Message Date
Sosthene
ff67a6b7e9 [bug] Now save device after scan_blocks 2025-08-27 17:27:59 +02:00

View File

@ -1419,17 +1419,8 @@ export default class Services {
let new_states = []; let new_states = [];
let roles = []; let roles = [];
for (const state of process.states) { for (const state of process.states) {
if (!state || !state.state_id) { continue; } // shouldn't happen if (!state.state_id || state.state_id === EMPTY32BYTES) { continue; }
if (state.state_id === EMPTY32BYTES) { if (!this.lookForStateId(existing, state.state_id)) {
// We check that the tip is the same we have, if not we update
const existingTip = existing.states[existing.states.length - 1].commited_in;
if (existingTip !== state.commited_in) {
console.log('Found new tip for process', processId);
// We update the process
new_states.push(state.state_id);
roles.push(state.roles);
}
} else if (!this.lookForStateId(existing, state.state_id)) {
if (this.rolesContainsUs(state.roles)) { if (this.rolesContainsUs(state.roles)) {
new_states.push(state.state_id); new_states.push(state.state_id);
roles.push(state.roles); roles.push(state.roles);
@ -1439,12 +1430,6 @@ export default class Services {
if (new_states.length != 0) { if (new_states.length != 0) {
// We request the new states // We request the new states
// filter out the empty state, if any
// empty state will always be last, so that's easy
if (new_states.findLast(state => state === EMPTY32BYTES)) {
new_states.pop();
roles.pop();
}
await this.requestDataFromPeers(processId, new_states, roles); await this.requestDataFromPeers(processId, new_states, roles);
toSave[processId] = process; toSave[processId] = process;
} }