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

Add CapabilityRequiringPayload to TradeStatistics2 #3525

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
import bisq.core.offer.OfferPayload;
import bisq.core.offer.OfferUtil;

import bisq.network.p2p.storage.payload.CapabilityRequiringPayload;
import bisq.network.p2p.storage.payload.LazyProcessedPayload;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.crypto.Hash;
import bisq.common.proto.persistable.PersistableEnvelope;
import bisq.common.util.ExtraDataMapValidator;
Expand Down Expand Up @@ -60,7 +63,7 @@

@Slf4j
@Value
public final class TradeStatistics2 implements LazyProcessedPayload, PersistableNetworkPayload, PersistableEnvelope {
public final class TradeStatistics2 implements LazyProcessedPayload, PersistableNetworkPayload, PersistableEnvelope, CapabilityRequiringPayload {

//We don't support arbitrators anymore so this entry will be only for pre v1.2. trades
@Deprecated
Expand Down Expand Up @@ -231,6 +234,15 @@ public boolean verifyHashSize() {
return hash.length == 20;
}

// With v1.2.0 we changed the way how the hash is created. To not create too heavy load for seed nodes from
// requests from old nodes we use the SIGNED_ACCOUNT_AGE_WITNESS capability to send trade statistics only to new
// nodes. As trade statistics are only used for informational purpose it will not have any critical issue for the
// old nodes beside that they don't see the latest trades.
@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.SIGNED_ACCOUNT_AGE_WITNESS);
}


///////////////////////////////////////////////////////////////////////////////////////////
// Getters
Expand Down