mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Apply code inspection suggestions
This commit is contained in:
parent
27ac2d8e57
commit
74317636b0
16 changed files with 26 additions and 29 deletions
|
@ -25,7 +25,6 @@ import bisq.core.offer.OpenOfferManager;
|
|||
import bisq.core.setup.CorePersistedDataHost;
|
||||
import bisq.core.setup.CoreSetup;
|
||||
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.trade.txproof.xmr.XmrTxProofService;
|
||||
|
||||
import bisq.network.p2p.P2PService;
|
||||
|
@ -221,7 +220,6 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
|
|||
|
||||
try {
|
||||
injector.getInstance(ArbitratorManager.class).shutDown();
|
||||
injector.getInstance(TradeManager.class).shutDown();
|
||||
injector.getInstance(XmrTxProofService.class).shutDown();
|
||||
injector.getInstance(DaoSetup.class).shutDown();
|
||||
injector.getInstance(AvoidStandbyModeService.class).shutDown();
|
||||
|
|
|
@ -40,8 +40,8 @@ public class DumpDelayedPayoutTx {
|
|||
}
|
||||
|
||||
static class DelayedPayoutHash {
|
||||
String tradeId;
|
||||
String delayedPayoutTx;
|
||||
final String tradeId;
|
||||
final String delayedPayoutTx;
|
||||
|
||||
DelayedPayoutHash(String tradeId, String delayedPayoutTx) {
|
||||
this.tradeId = tradeId;
|
||||
|
|
|
@ -119,7 +119,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
|
||||
// #################### Phase DEPOSIT_PUBLISHED
|
||||
// We changes order in trade protocol of publishing deposit tx and sending it to the peer.
|
||||
// Now we send it first to the peer and only if that succeeds we publish it to avoid likelyhood of
|
||||
// Now we send it first to the peer and only if that succeeds we publish it to avoid likelihood of
|
||||
// failed trades. We do not want to change the order of the enum though so we keep it here as it was originally.
|
||||
SELLER_PUBLISHED_DEPOSIT_TX(Phase.DEPOSIT_PUBLISHED),
|
||||
|
||||
|
@ -438,7 +438,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
@Setter
|
||||
private long lastRefreshRequestDate;
|
||||
@Getter
|
||||
private long refreshInterval;
|
||||
private final long refreshInterval;
|
||||
private static final long MAX_REFRESH_INTERVAL = 4 * ChronoUnit.HOURS.getDuration().toMillis();
|
||||
|
||||
// Added at v1.3.8
|
||||
|
@ -756,8 +756,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
}
|
||||
|
||||
public void removeDecryptedMessageWithPubKey(DecryptedMessageWithPubKey decryptedMessageWithPubKey) {
|
||||
if (decryptedMessageWithPubKeySet.contains(decryptedMessageWithPubKey))
|
||||
decryptedMessageWithPubKeySet.remove(decryptedMessageWithPubKey);
|
||||
decryptedMessageWithPubKeySet.remove(decryptedMessageWithPubKey);
|
||||
}
|
||||
|
||||
public void addAndPersistChatMessage(ChatMessage chatMessage) {
|
||||
|
|
|
@ -180,7 +180,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
p2PService.addDecryptedDirectMessageListener(this);
|
||||
p2PService.addDecryptedMailboxListener(this);
|
||||
|
||||
failedTradesManager.setUnfailTradeCallback(this::unFailTrade);
|
||||
failedTradesManager.setUnFailTradeCallback(this::unFailTrade);
|
||||
}
|
||||
|
||||
|
||||
|
@ -315,10 +315,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
});
|
||||
}
|
||||
|
||||
public void shutDown() {
|
||||
// Do nothing here
|
||||
}
|
||||
|
||||
public void persistTrades() {
|
||||
tradableList.persist();
|
||||
}
|
||||
|
@ -621,7 +617,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
// Aborts unfailing if the address entries needed are not available
|
||||
private boolean unFailTrade(Trade trade) {
|
||||
if (!recoverAddresses(trade)) {
|
||||
log.warn("Failed to recover address during unfail trade");
|
||||
log.warn("Failed to recover address during unFail trade");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FailedTradesManager implements PersistedDataHost {
|
|||
private final Storage<TradableList<Trade>> tradableListStorage;
|
||||
private final DumpDelayedPayoutTx dumpDelayedPayoutTx;
|
||||
@Setter
|
||||
private Function<Trade, Boolean> unfailTradeCallback;
|
||||
private Function<Trade, Boolean> unFailTradeCallback;
|
||||
|
||||
@Inject
|
||||
public FailedTradesManager(KeyRing keyRing,
|
||||
|
@ -108,17 +108,17 @@ public class FailedTradesManager implements PersistedDataHost {
|
|||
.filter(Trade::isFundsLockedIn);
|
||||
}
|
||||
|
||||
public void unfailTrade(Trade trade) {
|
||||
if (unfailTradeCallback == null)
|
||||
public void unFailTrade(Trade trade) {
|
||||
if (unFailTradeCallback == null)
|
||||
return;
|
||||
|
||||
if (unfailTradeCallback.apply(trade)) {
|
||||
if (unFailTradeCallback.apply(trade)) {
|
||||
log.info("Unfailing trade {}", trade.getId());
|
||||
failedTrades.remove(trade);
|
||||
}
|
||||
}
|
||||
|
||||
public String checkUnfail(Trade trade) {
|
||||
public String checkUnFail(Trade trade) {
|
||||
var addresses = TradeUtils.getTradeAddresses(trade, btcWalletService, keyRing);
|
||||
if (addresses == null) {
|
||||
return "Addresses not found";
|
||||
|
|
|
@ -28,6 +28,7 @@ import lombok.Value;
|
|||
* We do the re-sending of the payment sent message via the BuyerSendCounterCurrencyTransferStartedMessage task on the
|
||||
* buyer side, so seller do not need to do anything interactively.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
public class RefreshTradeStateRequest extends TradeMessage implements MailboxMessage {
|
||||
|
|
|
@ -27,6 +27,7 @@ import bisq.common.app.Version;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
public class TraderSignedWitnessMessage extends TradeMessage implements MailboxMessage {
|
||||
|
|
|
@ -130,7 +130,7 @@ public abstract class BuyerProtocol extends DisputeProtocol {
|
|||
BuyerEvent event = BuyerEvent.PAYMENT_SENT;
|
||||
expect(phase(Trade.Phase.DEPOSIT_CONFIRMED)
|
||||
.with(event)
|
||||
.preCondition(!wasDisputed()))
|
||||
.preCondition(notDisputed()))
|
||||
.setup(tasks(ApplyFilter.class,
|
||||
getVerifyPeersFeePaymentClass(),
|
||||
BuyerSignPayoutTx.class,
|
||||
|
|
|
@ -55,8 +55,8 @@ public class DisputeProtocol extends TradeProtocol {
|
|||
super(trade);
|
||||
}
|
||||
|
||||
protected boolean wasDisputed() {
|
||||
return trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE;
|
||||
protected boolean notDisputed() {
|
||||
return trade.getDisputeState() == Trade.DisputeState.NO_DISPUTE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public abstract class SellerProtocol extends DisputeProtocol {
|
|||
SellerEvent event = SellerEvent.PAYMENT_RECEIVED;
|
||||
expect(phase(Trade.Phase.FIAT_SENT)
|
||||
.with(event)
|
||||
.preCondition(!wasDisputed()))
|
||||
.preCondition(notDisputed()))
|
||||
.setup(tasks(
|
||||
ApplyFilter.class,
|
||||
getVerifyPeersFeePaymentClass(),
|
||||
|
|
|
@ -44,7 +44,7 @@ import javax.annotation.Nullable;
|
|||
public abstract class TradeProtocol implements DecryptedDirectMessageListener {
|
||||
|
||||
protected final ProcessModel processModel;
|
||||
protected Trade trade;
|
||||
protected final Trade trade;
|
||||
private Timer timeoutTimer;
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
public final class TradeStatistics2 implements ProcessOncePersistableNetworkPayload, PersistableNetworkPayload,
|
||||
CapabilityRequiringPayload, Comparable<TradeStatistics2> {
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public static final String MEDIATOR_ADDRESS = "medAddr";
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public static final String REFUND_AGENT_ADDRESS = "refAddr";
|
||||
|
||||
private final OfferPayload.Direction direction;
|
||||
|
|
|
@ -40,7 +40,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@Slf4j
|
||||
public class TradeStatistics2Store implements ThreadedPersistableEnvelope {
|
||||
@Getter
|
||||
private Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> map = new ConcurrentHashMap<>();
|
||||
private final Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> map = new ConcurrentHashMap<>();
|
||||
|
||||
TradeStatistics2Store() {
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class TradeStatisticsManager {
|
|||
}
|
||||
|
||||
static class WrapperTradeStatistics2 {
|
||||
private TradeStatistics2 tradeStatistics;
|
||||
private final TradeStatistics2 tradeStatistics;
|
||||
|
||||
public WrapperTradeStatistics2(TradeStatistics2 tradeStatistics) {
|
||||
this.tradeStatistics = tradeStatistics;
|
||||
|
|
|
@ -80,7 +80,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
private final Socks5ProxyProvider socks5ProxyProvider;
|
||||
private final Map<String, XmrTxProofRequestsPerTrade> servicesByTradeId = new HashMap<>();
|
||||
private AutoConfirmSettings autoConfirmSettings;
|
||||
private Map<String, ChangeListener<Trade.State>> tradeStateListenerMap = new HashMap<>();
|
||||
private final Map<String, ChangeListener<Trade.State>> tradeStateListenerMap = new HashMap<>();
|
||||
private ChangeListener<Number> btcPeersListener, btcBlockListener;
|
||||
private BootstrapListener bootstrapListener;
|
||||
private MonadicBinding<Boolean> p2pNetworkAndWalletReady;
|
||||
|
|
|
@ -83,10 +83,10 @@ class FailedTradesDataModel extends ActivatableDataModel {
|
|||
}
|
||||
|
||||
public void unfailTrade(Trade trade) {
|
||||
failedTradesManager.unfailTrade(trade);
|
||||
failedTradesManager.unFailTrade(trade);
|
||||
}
|
||||
|
||||
public String checkUnfail(Trade trade) {
|
||||
return failedTradesManager.checkUnfail(trade);
|
||||
return failedTradesManager.checkUnFail(trade);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue