Solve contract deadlocks delaying progress of QVAULT #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This solves the deadlock happening when QX::TransferShareManagementRights() is invoked from another contract C2, see issue #296
C2 invokes a procedure of C1 (e.g., QX) that calls qpi.releaseShares() for transferring management rights to C2. The state of contract C2 is already locked for writing when C1 is calling qpi.releaseShares(), which tries to acquire the write lock again (all in the same processor).
This PR should solve all similar deadlocks with callbacks if no other processor is involved (no parallel contract function calls locking states next to contract procedure).