mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-05 21:24:19 -04:00
Use Persistable interface for local db data
This commit is contained in:
parent
8792666f78
commit
6a25e1c56c
71 changed files with 216 additions and 196 deletions
|
@ -18,7 +18,7 @@
|
|||
package io.bitsquare.alert;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.storage.messages.StoragePayload;
|
||||
import io.bitsquare.p2p.storage.data.StoragePayload;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
|
@ -20,7 +20,7 @@ package io.bitsquare.arbitration;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.crypto.PubKeyRing;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.p2p.storage.messages.StoragePayload;
|
||||
import io.bitsquare.p2p.storage.data.StoragePayload;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.util.Arrays;
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.arbitration;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.messages.DisputeCommunicationMessage;
|
||||
import io.bitsquare.common.crypto.PubKeyRing;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.Contract;
|
||||
import javafx.beans.property.*;
|
||||
|
@ -32,13 +33,12 @@ import org.slf4j.LoggerFactory;
|
|||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public final class Dispute implements Serializable {
|
||||
public final class Dispute implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(Dispute.class);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package io.bitsquare.arbitration;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -27,10 +28,9 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DisputeList<DisputeCase> extends ArrayList<DisputeCase> implements Serializable {
|
||||
public class DisputeList<DisputeCase> extends ArrayList<DisputeCase> implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bitsquare.arbitration;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.messages.DisputeCommunicationMessage;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
import javafx.beans.property.*;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -26,11 +27,10 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
public final class DisputeResult implements Serializable {
|
||||
public final class DisputeResult implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(DisputeResult.class);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package io.bitsquare.arbitration.payload;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class Attachment implements Serializable {
|
||||
public final class Attachment implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(Attachment.class);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package io.bitsquare.btc;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.crypto.DeterministicKey;
|
||||
|
@ -30,14 +31,13 @@ import org.slf4j.LoggerFactory;
|
|||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Every trade use a addressEntry with a dedicated address for all transactions related to the trade.
|
||||
* That way we have a kind of separated trade wallet, isolated from other transactions and avoiding coin merge.
|
||||
* If we would not avoid coin merge the user would lose privacy between trades.
|
||||
*/
|
||||
public class AddressEntry implements Serializable {
|
||||
public class AddressEntry implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,19 +19,19 @@ package io.bitsquare.btc;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import org.bitcoinj.core.Wallet;
|
||||
import org.bitcoinj.crypto.DeterministicKey;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* The List supporting our persistence solution.
|
||||
*/
|
||||
public class AddressEntryList extends ArrayList<AddressEntry> implements Serializable {
|
||||
public class AddressEntryList extends ArrayList<AddressEntry> implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(AddressEntryList.class);
|
||||
|
|
|
@ -17,15 +17,13 @@
|
|||
|
||||
package io.bitsquare.btc;
|
||||
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.params.MainNetParams;
|
||||
import org.bitcoinj.params.RegTestParams;
|
||||
import org.bitcoinj.params.TestNet3Params;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public enum BitcoinNetwork implements Serializable {
|
||||
|
||||
public enum BitcoinNetwork implements Persistable {
|
||||
MAINNET(MainNetParams.get()),
|
||||
TESTNET(TestNet3Params.get()),
|
||||
REGTEST(RegTestParams.get());
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
package io.bitsquare.btc.data;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class RawInput implements Serializable {
|
||||
public final class RawInput implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Immutable
|
||||
public class Country implements Serializable {
|
||||
public class Country implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CryptoCurrency extends TradeCurrency implements Serializable {
|
||||
public class CryptoCurrency extends TradeCurrency implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.user.Preferences;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Currency;
|
||||
|
||||
public class FiatCurrency extends TradeCurrency implements Serializable {
|
||||
public class FiatCurrency extends TradeCurrency implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Immutable
|
||||
public class Region implements Serializable {
|
||||
public class Region implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TradeCurrency implements Serializable {
|
||||
public class TradeCurrency implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ package io.bitsquare.payment;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.locale.FiatCurrency;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AliPayAccount extends PaymentAccount implements Serializable {
|
||||
public class AliPayAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class AliPayAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class AliPayAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BlockChainAccount extends PaymentAccount implements Serializable {
|
||||
public class BlockChainAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class BlockChainAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class BlockChainAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
@ -49,7 +47,7 @@ public final class BlockChainAccountContractData extends PaymentAccountContractD
|
|||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return getPaymentDetails();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPaymentId(String paymentId) {
|
||||
this.paymentId = paymentId;
|
||||
|
|
|
@ -22,9 +22,7 @@ import io.bitsquare.locale.CurrencyUtil;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OKPayAccount extends PaymentAccount implements Serializable {
|
||||
public class OKPayAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class OKPayAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class OKPayAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -18,19 +18,19 @@
|
|||
package io.bitsquare.payment;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.TradeCurrency;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PaymentAccount implements Serializable {
|
||||
public class PaymentAccount implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
package io.bitsquare.payment;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class PaymentAccountContractData implements Serializable {
|
||||
public abstract class PaymentAccountContractData implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
package io.bitsquare.payment;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
// Don't use Enum as it breaks serialisation when changing entries and we want to stay flexible here
|
||||
public class PaymentMethod implements Serializable, Comparable {
|
||||
public class PaymentMethod implements Persistable, Comparable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ package io.bitsquare.payment;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.locale.FiatCurrency;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PerfectMoneyAccount extends PaymentAccount implements Serializable {
|
||||
public class PerfectMoneyAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class PerfectMoneyAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class PerfectMoneyAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -19,10 +19,9 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class SepaAccount extends PaymentAccount implements Serializable {
|
||||
public class SepaAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@ import io.bitsquare.locale.CountryUtil;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class SepaAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class SepaAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ package io.bitsquare.payment;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.locale.FiatCurrency;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SwishAccount extends PaymentAccount implements Serializable {
|
||||
public class SwishAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ package io.bitsquare.payment;
|
|||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class SwishAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
public final class SwishAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@ import io.bitsquare.payment.PaymentMethod;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
// US only
|
||||
public class FedWireAccount extends PaymentAccount implements Serializable {
|
||||
public class FedWireAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -23,9 +23,7 @@ import io.bitsquare.payment.PaymentMethod;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TransferWiseAccount extends PaymentAccount implements Serializable {
|
||||
public class TransferWiseAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@ import io.bitsquare.payment.PaymentAccount;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class USPostalMoneyOrderAccount extends PaymentAccount implements Serializable {
|
||||
public class USPostalMoneyOrderAccount extends PaymentAccount {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -28,11 +28,9 @@ import org.bitcoinj.core.Coin;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
public abstract class BuyerTrade extends Trade implements Serializable {
|
||||
public abstract class BuyerTrade extends Trade {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -20,20 +20,20 @@ package io.bitsquare.trade;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.crypto.PubKeyRing;
|
||||
import io.bitsquare.common.util.JsonExclude;
|
||||
import io.bitsquare.common.wire.Payload;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@Immutable
|
||||
public final class Contract implements Serializable {
|
||||
public final class Contract implements Payload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
@JsonExclude
|
||||
public static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
|
|
@ -26,11 +26,9 @@ import org.bitcoinj.core.Coin;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
public abstract class SellerTrade extends Trade implements Serializable {
|
||||
public abstract class SellerTrade extends Trade {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public interface Tradable extends Serializable {
|
||||
public interface Tradable extends Persistable {
|
||||
Offer getOffer();
|
||||
|
||||
Date getDate();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -26,10 +27,9 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TradableList<T extends Tradable> extends ArrayList<T> implements Serializable {
|
||||
public class TradableList<T extends Tradable> extends ArrayList<T> implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -50,14 +50,13 @@ import org.slf4j.LoggerFactory;
|
|||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Holds all data which are relevant to the trade, but not those which are only needed in the trade process as shared data between tasks. Those data are
|
||||
* stored in the task model.
|
||||
*/
|
||||
abstract public class Trade implements Tradable, Model, Serializable {
|
||||
abstract public class Trade implements Tradable, Model {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ import io.bitsquare.common.handlers.ResultHandler;
|
|||
import io.bitsquare.common.util.JsonExclude;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.p2p.storage.messages.RequiresOwnerIsOnlinePayload;
|
||||
import io.bitsquare.p2p.storage.messages.StoragePayload;
|
||||
import io.bitsquare.p2p.storage.data.RequiresOwnerIsOnlinePayload;
|
||||
import io.bitsquare.p2p.storage.data.StoragePayload;
|
||||
import io.bitsquare.payment.PaymentMethod;
|
||||
import io.bitsquare.trade.protocol.availability.OfferAvailabilityModel;
|
||||
import io.bitsquare.trade.protocol.availability.OfferAvailabilityProtocol;
|
||||
|
|
|
@ -122,13 +122,12 @@ public class OpenOfferManager {
|
|||
});
|
||||
|
||||
NetworkNode networkNode = p2PService.getNetworkNode();
|
||||
|
||||
// TODO: Use check for detecting inactivity instead. run timer and check if elapsed time is in expected range,
|
||||
// if not we have been in standby and need a republish
|
||||
networkNode.addConnectionListener(new ConnectionListener() {
|
||||
@Override
|
||||
public void onConnection(Connection connection) {
|
||||
log.error("ConnectionListener onConnection size " + networkNode.getAllConnections().size());
|
||||
log.error("ConnectionListener onConnection lostAllConnections " + lostAllConnections);
|
||||
log.error("ConnectionListener onConnection allowRefreshOffers " + allowRefreshOffers);
|
||||
log.error("ConnectionListener onConnection republishOffersTime " + republishOffersTime);
|
||||
if (lostAllConnections) {
|
||||
lostAllConnections = false;
|
||||
allowRefreshOffers = false;
|
||||
|
@ -148,7 +147,6 @@ public class OpenOfferManager {
|
|||
|
||||
@Override
|
||||
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
||||
log.error("ConnectionListener onDisconnect size " + networkNode.getAllConnections().size());
|
||||
lostAllConnections = networkNode.getAllConnections().isEmpty();
|
||||
if (lostAllConnections)
|
||||
allowRefreshOffers = false;
|
||||
|
@ -225,7 +223,6 @@ public class OpenOfferManager {
|
|||
}
|
||||
|
||||
private void republishOffers() {
|
||||
log.error("republishOffers ");
|
||||
Log.traceCall("Number of offer for republish: " + openOffers.size());
|
||||
for (OpenOffer openOffer : openOffers) {
|
||||
offerBookService.republishOffers(openOffer.getOffer(),
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.data.RawInput;
|
||||
import io.bitsquare.common.crypto.PubKeyRing;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -27,10 +28,9 @@ import org.slf4j.LoggerFactory;
|
|||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TradingPeer implements Serializable {
|
||||
public class TradingPeer implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
package io.bitsquare.user;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BlockChainExplorer implements Serializable {
|
||||
public class BlockChainExplorer implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import io.bitsquare.app.BitsquareEnvironment;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.BitcoinNetwork;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.locale.TradeCurrency;
|
||||
|
@ -39,10 +40,9 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
public class Preferences implements Serializable {
|
||||
public class Preferences implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import io.bitsquare.alert.Alert;
|
|||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.Arbitrator;
|
||||
import io.bitsquare.common.crypto.KeyRing;
|
||||
import io.bitsquare.common.persistance.Persistable;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
import io.bitsquare.locale.TradeCurrency;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
|
@ -38,7 +39,6 @@ import javax.annotation.Nullable;
|
|||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -48,7 +48,7 @@ import java.util.stream.Collectors;
|
|||
* The User is persisted locally.
|
||||
* It must never be transmitted over the wire (messageKeyPair contains private key!).
|
||||
*/
|
||||
public class User implements Serializable {
|
||||
public class User implements Persistable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue