Handle modified states
This commit is contained in:
parent
d5aa9aff43
commit
5bbf0d33f5
@ -321,12 +321,24 @@ export default class Services {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatedProcess.modified_state || updatedProcess.new_state) {
|
if (updatedProcess.new_state) {
|
||||||
this.currentProcess = updatedProcess.commitment_tx;
|
this.currentProcess = updatedProcess.commitment_tx;
|
||||||
|
|
||||||
this.getUpdateProposals(this.currentProcess!);
|
this.getUpdateProposals(this.currentProcess!);
|
||||||
|
|
||||||
await this.evaluatePendingUpdates();
|
await this.evaluatePendingUpdates();
|
||||||
|
} else if (updatedProcess.modified_state) {
|
||||||
|
// We added validation tokens
|
||||||
|
// We check if the state is now valid
|
||||||
|
// If enough validation tokens we shoot a commit msg to the relay
|
||||||
|
const [previous_state, new_state] = updatedProcess.modified_state;
|
||||||
|
const init_commitment = updatedProcess.commitment_tx;
|
||||||
|
try {
|
||||||
|
const apiReturn = this.sdkClient.evaluate_state(init_commitment, null, JSON.stringify(new_state));
|
||||||
|
await this.handleApiReturn(apiReturn);
|
||||||
|
} catch (e) {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user