Skip to content

Commit

Permalink
Republish trade statistics from seller side if peer capability is kno…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
chimp1984 committed Oct 8, 2020
1 parent 197d8c1 commit 18a27e9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,45 @@

import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;
import bisq.common.util.Utilities;

import java.util.Date;
import java.util.GregorianCalendar;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class SellerProtocol extends DisputeProtocol {
enum SellerEvent implements FluentProtocol.Event {
STARTUP,
PAYMENT_RECEIVED
}

public SellerProtocol(SellerTrade trade) {
super(trade);
}

@Override
protected void onInitialized() {
super.onInitialized();

// We get called the constructor with any possible state and phase. As we don't want to log an error for such
// cases we use the alternative 'given' method instead of 'expect'.

// We only re-publish for about 2 weeks after 1.4.0 release until most nodes have updated to
// achieve sufficient resilience.
boolean currentDateBeforeCutOffDate = new Date().before(Utilities.getUTCDate(2020, GregorianCalendar.NOVEMBER, 1));
given(anyPhase(Trade.Phase.DEPOSIT_PUBLISHED,
Trade.Phase.DEPOSIT_CONFIRMED,
Trade.Phase.FIAT_SENT,
Trade.Phase.FIAT_RECEIVED,
Trade.Phase.PAYOUT_PUBLISHED)
.with(SellerEvent.STARTUP)
.preCondition(currentDateBeforeCutOffDate))
.setup(tasks(SellerPublishesTradeStatistics.class))
.executeTasks();
}


///////////////////////////////////////////////////////////////////////////////////////////
// Mailbox
Expand Down

0 comments on commit 18a27e9

Please sign in to comment.