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 PR fixes an issue with not removed mailbox messages from the trade process.
I redesigned the way how we remove the messages. Instead of removing it from the network after successful processing we remove it immediately when we received it after the listeners are called. We keep it locally stored so in case the client was not ready to process it at that moment it requests the data later. We also persist the messages for the edge case that the user shuts down the app before the client was ready for processing. In that case the message wuld be lost if not persisted as it was removed from the network but only kept in RAM for later access which is lost at restart. By persisting the data we get them again at restart.
After processing we also try to remove the data if still in the P2PDataStorage to be sure that the message got removed from the network if the initial removal failed because we have not been bootstrapped.
By removing the messages at receipt we can expect that the number of messages will go down quite a lot. Currently its about 1000, normally it was about 400-600. I guess after that release and when old messages have been cleaned from TTL we might have only about 200-300 messages in the network.
This PR did only the minimum of changes to limit risks for this release. We should clean up later a bit more and continue refactoring the mailbox message handling so it gets more robust and uniform.