Add getUncommitedStates()

This commit is contained in:
Sosthene 2025-07-07 15:23:47 +02:00
parent deebcefc3d
commit 5a8c31df32

View File

@ -1473,6 +1473,13 @@ export default class Services {
return null;
}
public getUncommitedStates(process: Process): ProcessState[] {
if (process.states.length === 0) return [];
const processTip = process.states[process.states.length - 1].commited_in;
const res = process.states.filter(state => state.commited_in === processTip);
return res.filter(state => state.state_id !== EMPTY32BYTES);
}
public getStateFromId(process: Process, stateId: string): ProcessState | null {
if (process.states.length === 0) return null;
const state = process.states.find(state => state.state_id === stateId);