Skip to content

Commit

Permalink
Merge pull request #3525 from chimp1984/add-capability-to-tradestats
Browse files Browse the repository at this point in the history
Add CapabilityRequiringPayload to TradeStatistics2
  • Loading branch information
ripcurlx authored Oct 30, 2019
2 parents 98cd6c4 + ce0c745 commit 42fcee4
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit 42fcee4

Please sign in to comment.