Compare commits

..

2 Commits

Author SHA1 Message Date
Sosthene
acb9739a80 [bug] Now save device after scan_blocks 2025-09-02 13:30:52 +02:00
Sosthene
c422881cd1 [bug] Failed to update tips 2025-09-02 13:30:52 +02:00

View File

@ -1419,8 +1419,17 @@ export default class Services {
let new_states = [];
let roles = [];
for (const state of process.states) {
if (!state.state_id || state.state_id === EMPTY32BYTES) { continue; }
if (!this.lookForStateId(existing, state.state_id)) {
if (!state || !state.state_id) { continue; } // shouldn't happen
if (state.state_id === EMPTY32BYTES) {
// 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)) {
new_states.push(state.state_id);
roles.push(state.roles);
@ -1430,6 +1439,12 @@ export default class Services {
if (new_states.length != 0) {
// 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);
toSave[processId] = process;
}