Republish trade statistics from seller side if peer capability is know. This is not the case without getting PR #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.
This commit is contained in:
chimp1984 2020-10-08 13:00:31 -05:00
parent 197d8c1e0d
commit 18a27e9067
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3

View File

@ -39,12 +39,17 @@ import bisq.network.p2p.NodeAddress;
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
}
@ -52,6 +57,27 @@ public abstract class SellerProtocol extends DisputeProtocol {
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