Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New trade statistics #4611

Merged
merged 59 commits into from
Oct 9, 2020

Conversation

chimp1984
Copy link
Contributor

@chimp1984 chimp1984 commented Oct 8, 2020

Replaces #4599

Based on #4610 . Initial commits are from #4610. Starts at commit 00bed02

We replace the old trade statistics which a minimal version and reduce data size from 16.5 MB to 3.9 MB. The old data gets converted to the new format.

Not updated users will not see new trade statistics and old ones only if they have peers with the old version as well. As all seed nodes will run the updated version they will not provide the old statistics. So for those users it will look weird that trade volume goes to zero over time. But I think that is an acceptable price and the alternative would be higher complexity by supporting boths trade statistics still. As 1.4.0 has so many important features I guess most active users will update quickly anyway.

If 2 traders with an old version trade they will publish both the statistics and new nodes will convert them to new trade stats using the hash of the old as hash for the new and so avoiding duplicates.
If 1 of the peers has update and the other not it will be detected via capabilities. In the new version onlt the seller publishes. So if the new version is the buyer he will not publish anyway, so we have only the old version publsihed and get converted to the new version by receiving peers. If the updated user is the seller he will check the capability of the peer and if its an old verison he will no publish so that the buyer with the old version publishes. If both users have updated then only the seller publishes.
So we have only one scenario where both publish (both have not updated) and we solve that with using the hash.

At startup we convert the existing trades stats to the new version (running in a thread, takes about 4 sec). After that we delete the old trade stats. The old trade stats will be excluded from initial data requests and response.

chimp1984 and others added 30 commits October 8, 2020 18:23
Add `boolean contains(Capability capability)` method
Remove debug log, remove annotation
Set address prefix to empty bytes in case we know that peer has capability (updated version)
Batch process mailbox messages in a thread.
Refactor handling of mailbox messages
Make capabilities final

If capability changes we would have had duplicate entries
The check for AckMessage is not needed anymore as we remove the interface from AckMessage
Impl. applyCapabilities

Cleanups
Rename getOptionalPersistedPeer to findPersistedPeer
Improve getConnectedReportedPeers method
…onnection.hasPeersNodeAddress() which does the same internally
…node from persisted peers.

Remove log in DisputeAgentManager which gets called repeatedly
1. We do not want that initial data request/response use old trades statistics for excluded key hashes.
Thats why we return an empty map in getMap.
2. We do not read resource file as we have removed that.
3. We do not persist as we convert the existing data and re-publish as new data, or at startup we convert the old data to the new one and then delete the file.
…table to enforce inclusion.

Cleanups, renamings
…ds on my machine.

Add shutdown method to TradeStatisticsConverter and call it via TradeStatisticsManager. Now as we have a reference to TradeStatisticsConverter in we don't need the hack anymore in applyInjector.
Set log level for com.neemre.btcdcli4j.core.client.ClientConfigurator to error as there is an expected warn log because of the outdated version.
@ripcurl: The complaint about private constructors (using guice this is legit) should be removed IMO.
…w. This is not the case without getting PR bisq-network#4609 merges as well.

We only do it for 2 weeks after planned release time as then it can be assumed that enough nodes have updated that the normal publishing will distribute the object sufficiently.
@wiz
Copy link
Member

wiz commented Oct 9, 2020

Fixes #3893

@ripcurlx ripcurlx merged commit 3687a03 into bisq-network:release/v1.4.0 Oct 9, 2020
@ripcurlx ripcurlx added this to the v1.4.0 milestone Oct 9, 2020
@chimp1984 chimp1984 deleted the new-trade-statistics branch October 17, 2020 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants