Wait until RPC write is reflected on the read
jmoreira-valory opened this issue · comments
jmoreira-valory commented
Sometimes the following issue occurs with RPC:
- Script sends a write operation to the contract (using autonomy CLI). Service state changes from A->B. This transaction is acknowledged by RPC.
- Script reads the state of the contract, and still gets Service in state A.
To mitigate this, sleep after contract calls have been introduced. However, the following improvement is suggested:
Create a method which waits until the state is the expected one (or times out after a generous time margin ~5min.). This would be similar to what is done in the method to ensure that addressess are funded.
jmoreira-valory commented
Addressed in #227