Avoid case of multi trades with same offer #4889
Merged
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.
Fixes #4879
We had removed the offer after the first trade task. If it failed there the offer stayed online and could be taken by another user. This caused the issue that one failed trade was in the trade list and then later a valid trade entered as well. As we used the offerId as key for a map which was used for the processModel lookup, that caused a bug with a Nullpointer exception.
This PR fixes that problem by using a uid instead of the offerId to make the map lookup more solid.
It also moves the task to remove the offer as the very first task so it cannot happen anymore that a offer stays online and leads later to 2 trades with the same offer id.
It also increased the realtively short timeout of 30 seconds in the some trade protocol task runners. We saw some cases where those timeouts triggered errorMessages but the trade could complete without problem, so that should help to reduce such cases. We do not fail on those timeouts, they only trigger an error message. The general trade protocol timeout would cause a failure of the trade.