mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
Add error handling for serialization inconsistency
This commit is contained in:
parent
0344235a23
commit
63c9b4670f
56 changed files with 210 additions and 71 deletions
|
@ -27,8 +27,8 @@ public class Version {
|
|||
public static final int MINOR_VERSION = 2;
|
||||
public static final int PATCH_VERSION = 1;
|
||||
|
||||
public static final byte[] NETWORK_PROTOCOL_VERSION = new byte[]{0x01};
|
||||
public static final int LOCLA_DB_VERSION = 1;
|
||||
public static final long NETWORK_PROTOCOL_VERSION = 1;
|
||||
public static final long LOCAL_DB_VERSION = 1;
|
||||
|
||||
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + PATCH_VERSION;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.arbitration;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.Util;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class ArbitrationRepository implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
transient private static final Logger log = LoggerFactory.getLogger(ArbitrationRepository.class);
|
||||
|
||||
transient private final ArbitratorService arbitratorService;
|
||||
|
@ -63,7 +64,6 @@ public class ArbitrationRepository implements Serializable {
|
|||
public ArbitrationRepository(Storage<ArbitrationRepository> storage,
|
||||
Storage<Arbitrator> arbitratorStorage,
|
||||
ArbitratorService arbitratorService) throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||
Storage<ArbitrationRepository> storage1 = storage;
|
||||
this.arbitratorService = arbitratorService;
|
||||
|
||||
byte[] walletPubKey = Utils.HEX.decode("03a418bf0cb60a35ce217c7f80a2db08a4f5efbe56a0e7602fbc392dea6b63f840");
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.arbitration;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -30,7 +31,7 @@ import java.util.Objects;
|
|||
|
||||
public class Arbitrator implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.arbitration;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
//TODO still open if we use that really...
|
||||
|
@ -26,7 +28,7 @@ import java.io.Serializable;
|
|||
*/
|
||||
public class Reputation implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
//TODO
|
||||
public Reputation() {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.btc;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.crypto.DeterministicKey;
|
||||
|
@ -31,9 +33,9 @@ import org.jetbrains.annotations.NotNull;
|
|||
*/
|
||||
public class AddressEntry implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
// that will be restored from the wallet at deserialisation
|
||||
// that will be restored from the wallet at deserialization
|
||||
private transient DeterministicKey keyPair;
|
||||
|
||||
private final String offerId;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.btc;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import org.bitcoinj.core.Wallet;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class AddressEntryList extends ArrayList<AddressEntry> implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
transient private static final Logger log = LoggerFactory.getLogger(AddressEntryList.class);
|
||||
|
||||
final transient private Storage<AddressEntryList> storage;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.crypto;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
@ -24,7 +26,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class Bucket implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final byte[] encryptedKey;
|
||||
public final byte[] encryptedPayload;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.crypto;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.security.KeyFactory;
|
||||
|
@ -37,7 +39,7 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
public class PubKeyRing implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PubKeyRing.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.crypto;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Message;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -35,7 +36,7 @@ import javax.crypto.SealedObject;
|
|||
*/
|
||||
public class SealedAndSignedMessage implements Serializable, Message {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SealedAndSignedMessage.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.fiat;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.locale.Country;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -30,7 +31,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class FiatAccount implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public static final long HOUR_IN_BLOCKS = 6;
|
||||
public static final long DAY_IN_BLOCKS = HOUR_IN_BLOCKS * 24;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
@ -24,7 +26,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class Country implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final String code;
|
||||
public final String name;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.locale;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
@ -24,7 +26,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class Region implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final String code;
|
||||
public final String name;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TomP2PNode implements ClientNode {
|
|||
private final Subject<BootstrappedPeerBuilder.State, BootstrappedPeerBuilder.State> bootstrapStateSubject;
|
||||
private final List<ResultHandler> resultHandlers = new CopyOnWriteArrayList<>();
|
||||
private final IntegerProperty numPeers = new SimpleIntegerProperty(0);
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.p2p.tomp2p;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
@ -35,7 +36,7 @@ import net.tomp2p.peers.PeerAddress;
|
|||
@Immutable
|
||||
public class TomP2PPeer implements Peer, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
private final PeerAddress peerAddress;
|
||||
|
||||
|
|
|
@ -55,6 +55,16 @@ public class Storage<T extends Serializable> {
|
|||
private static final Logger log = LoggerFactory.getLogger(Storage.class);
|
||||
public static final String DIR_KEY = "storage.dir";
|
||||
|
||||
private static DataBaseCorruptionHandler databaseCorruptionHandler;
|
||||
|
||||
public static void setDatabaseCorruptionHandler(DataBaseCorruptionHandler databaseCorruptionHandler) {
|
||||
Storage.databaseCorruptionHandler = databaseCorruptionHandler;
|
||||
}
|
||||
|
||||
public interface DataBaseCorruptionHandler {
|
||||
void onFileCorrupted(String fileName);
|
||||
}
|
||||
|
||||
private final File dir;
|
||||
private FileManager<T> fileManager;
|
||||
private File storageFile;
|
||||
|
@ -120,7 +130,8 @@ public class Storage<T extends Serializable> {
|
|||
log.info("Backup {} completed in {}msec", serializable.getClass().getSimpleName(), System.currentTimeMillis() - now);
|
||||
|
||||
return persistedObject;
|
||||
} catch (InvalidClassException e) {
|
||||
} catch (InvalidClassException | ClassCastException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
log.error("Version of persisted class has changed. We cannot read the persisted data anymore. We make a backup and remove the inconsistent " +
|
||||
"file.");
|
||||
try {
|
||||
|
@ -131,10 +142,11 @@ public class Storage<T extends Serializable> {
|
|||
log.error(e1.getMessage());
|
||||
// We swallow Exception if backup fails
|
||||
}
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
Throwables.propagate(e);
|
||||
databaseCorruptionHandler.onFileCorrupted(storageFile.getName());
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
log.error(throwable.getMessage());
|
||||
Throwables.propagate(throwable);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -35,7 +36,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class BuyerAsOffererTrade extends BuyerTrade implements OffererTrade, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class BuyerAsTakerTrade extends BuyerTrade implements TakerTrade, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public abstract class BuyerTrade extends Trade implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.PubKeyRing;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -31,7 +32,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class Contract implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final Offer offer;
|
||||
public final String takeOfferFeeTxID;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class SellerAsOffererTrade extends SellerTrade implements OffererTrade, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(SellerAsOffererTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class SellerAsTakerTrade extends SellerTrade implements TakerTrade, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(SellerAsTakerTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public abstract class SellerTrade extends Trade implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class TradableList<T extends Tradable> extends ArrayList<T> implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TradableList.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.ArbitrationRepository;
|
||||
import io.bitsquare.btc.BlockChainService;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
|
@ -68,7 +69,7 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
abstract public class Trade implements Tradable, Model, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
private transient static final Logger log = LoggerFactory.getLogger(Trade.class);
|
||||
|
||||
|
@ -78,7 +79,7 @@ abstract public class Trade implements Tradable, Model, Serializable {
|
|||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
|
||||
// Mutable
|
||||
private Coin tradeAmount;
|
||||
private Peer tradingPeer;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.offer;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.Restrictions;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.crypto.KeyRing;
|
||||
|
@ -48,7 +49,7 @@ import static com.google.common.base.Preconditions.*;
|
|||
|
||||
public class Offer implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
transient private static final Logger log = LoggerFactory.getLogger(Offer.class);
|
||||
|
||||
public enum Direction {BUY, SELL}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.offer;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.Tradable;
|
||||
import io.bitsquare.trade.TradableList;
|
||||
|
@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class OpenOffer implements Tradable, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OpenOffer.class);
|
||||
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.availability.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.PubKeyRing;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OfferAvailabilityRequest extends OfferMessage implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
private final PubKeyRing pubKeyRing;
|
||||
|
||||
|
|
|
@ -17,11 +17,13 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.availability.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OfferAvailabilityResponse extends OfferMessage implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final boolean isAvailable;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.availability.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Message;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -26,7 +27,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public abstract class OfferMessage implements Message, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final String offerId;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.ArbitrationRepository;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.BlockChainService;
|
||||
|
@ -50,7 +51,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class ProcessModel implements Model, Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProcessModel.class);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.PubKeyRing;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
|
||||
|
@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class TradingPeer implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TradingPeer.class);
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class TradingPeer implements Serializable {
|
|||
public void setAccountId(String accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
|
||||
public byte[] getTradeWalletPubKey() {
|
||||
return tradeWalletPubKey;
|
||||
}
|
||||
|
@ -87,7 +88,7 @@ public class TradingPeer implements Serializable {
|
|||
public void setTradeWalletPubKey(byte[] tradeWalletPubKey) {
|
||||
this.tradeWalletPubKey = tradeWalletPubKey;
|
||||
}
|
||||
|
||||
|
||||
public FiatAccount getFiatAccount() {
|
||||
return fiatAccount;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.PubKeyRing;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -28,7 +29,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class DepositTxInputsRequest extends TradeMessage implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final Coin tradeAmount;
|
||||
public final PubKeyRing sellerPubKeyRing;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.MailboxMessage;
|
||||
|
||||
import org.bitcoinj.core.Transaction;
|
||||
|
@ -28,7 +29,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class DepositTxPublishedMessage extends TradeMessage implements MailboxMessage, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final Transaction depositTx;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.MailboxMessage;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -26,7 +27,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class FiatTransferStartedMessage extends TradeMessage implements MailboxMessage, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final String buyerPayoutAddress;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.MailboxMessage;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -26,7 +27,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class FinalizePayoutTxRequest extends TradeMessage implements MailboxMessage, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final byte[] sellerSignature;
|
||||
public final String sellerPayoutAddress;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.crypto.PubKeyRing;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
|
||||
|
@ -32,7 +33,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class PayDepositRequest extends TradeMessage implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final List<TransactionOutput> buyerConnectedOutputsForAllInputs;
|
||||
public final List<TransactionOutput> buyerOutputs;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.MailboxMessage;
|
||||
|
||||
import org.bitcoinj.core.Transaction;
|
||||
|
@ -28,7 +29,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class PayoutTxFinalizedMessage extends TradeMessage implements MailboxMessage, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final Transaction payoutTx;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
|
||||
import org.bitcoinj.core.Transaction;
|
||||
|
@ -31,7 +32,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public class PublishDepositTxRequest extends TradeMessage implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final FiatAccount sellerFiatAccount;
|
||||
public final String sellerAccountId;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.trade.protocol.trade.messages;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.p2p.Message;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -26,7 +27,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public abstract class TradeMessage implements Message, Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
public final String tradeId;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class SignAndFinalizePayoutTx extends TradeTask {
|
|||
assert trade.getSecurityDeposit() != null;
|
||||
Coin sellerPayoutAmount = trade.getSecurityDeposit();
|
||||
Coin buyerPayoutAmount = sellerPayoutAmount.add(trade.getTradeAmount());
|
||||
|
||||
|
||||
Transaction transaction = processModel.getTradeWalletService().signAndFinalizePayoutTx(
|
||||
trade.getDepositTx(),
|
||||
processModel.tradingPeer.getSignature(),
|
||||
|
|
|
@ -48,7 +48,7 @@ public class CommitPayoutTx extends TradeTask {
|
|||
trade.setProcessState(BuyerTradeState.ProcessState.PAYOUT_TX_COMMITTED);
|
||||
else if (trade instanceof SellerTrade)
|
||||
trade.setProcessState(SellerTradeState.ProcessState.PAYOUT_TX_COMMITTED);
|
||||
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BroadcastTakeOfferFeeTx extends TradeTask {
|
|||
|
||||
/* if (trade instanceof SellerTrade)
|
||||
trade.setProcessState(TakerTradeState.ProcessState.TAKE_OFFER_FEE_PUBLISHED);*/
|
||||
|
||||
|
||||
complete();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.user;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.ArbitrationRepository;
|
||||
import io.bitsquare.arbitration.Arbitrator;
|
||||
import io.bitsquare.locale.Country;
|
||||
|
@ -38,7 +39,7 @@ import javax.inject.Inject;
|
|||
|
||||
public class AccountSettings implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
final transient private Storage<AccountSettings> storage;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.user;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import org.bitcoinj.utils.MonetaryFormat;
|
||||
|
@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class Preferences implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(Preferences.class);
|
||||
|
||||
|
|
|
@ -17,9 +17,12 @@
|
|||
|
||||
package io.bitsquare.user;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -46,7 +49,7 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
public class User implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(User.class);
|
||||
|
||||
|
@ -56,6 +59,7 @@ public class User implements Serializable {
|
|||
// Persisted fields
|
||||
private String accountID;
|
||||
private List<FiatAccount> fiatAccounts = new ArrayList<>();
|
||||
|
||||
private FiatAccount currentFiatAccount;
|
||||
|
||||
// Observable wrappers
|
||||
|
@ -94,6 +98,12 @@ public class User implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
log.trace("Created from serialized form.");
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
# Supported properties:
|
||||
# bitcoin.network=regtest | testnet | mainnet
|
||||
|
||||
bitcoin.network=regtest
|
||||
bitcoin.network = regtest
|
||||
|
|
|
@ -22,10 +22,10 @@ import io.bitsquare.gui.common.view.CachingViewLoader;
|
|||
import io.bitsquare.gui.common.view.View;
|
||||
import io.bitsquare.gui.common.view.ViewLoader;
|
||||
import io.bitsquare.gui.common.view.guice.InjectorViewFactory;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.main.MainView;
|
||||
import io.bitsquare.gui.main.debug.DebugView;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.util.Utilities;
|
||||
|
||||
import org.bitcoinj.utils.Threading;
|
||||
|
@ -35,15 +35,21 @@ import com.google.inject.Injector;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.image.*;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
|
||||
import org.controlsfx.dialog.Dialogs;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
|
@ -60,6 +66,8 @@ public class BitsquareApp extends Application {
|
|||
private Injector injector;
|
||||
private Stage primaryStage;
|
||||
private Scene scene;
|
||||
private List<String> corruptedDatabaseFiles = new ArrayList<>();
|
||||
private MainView mainView;
|
||||
|
||||
public static void setEnvironment(Environment env) {
|
||||
BitsquareApp.env = env;
|
||||
|
@ -68,6 +76,15 @@ public class BitsquareApp extends Application {
|
|||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
this.primaryStage = primaryStage;
|
||||
|
||||
// setup UncaughtExceptionHandler
|
||||
Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
|
||||
// Might come from another thread
|
||||
Platform.runLater(() -> showErrorPopup(throwable, true));
|
||||
};
|
||||
Thread.setDefaultUncaughtExceptionHandler(handler);
|
||||
Thread.currentThread().setUncaughtExceptionHandler(handler);
|
||||
|
||||
try {
|
||||
log.trace("BitsquareApp.start");
|
||||
|
||||
|
@ -80,6 +97,12 @@ public class BitsquareApp extends Application {
|
|||
URI.create("http://188.226.179.109/crashfx/upload"));*/
|
||||
// Server not setup yet, so we use client side only support
|
||||
|
||||
Storage.setDatabaseCorruptionHandler((String fileName) -> {
|
||||
corruptedDatabaseFiles.add(fileName);
|
||||
if (mainView != null)
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
});
|
||||
|
||||
// Guice
|
||||
bitsquareAppModule = new BitsquareAppModule(env, primaryStage);
|
||||
injector = Guice.createInjector(bitsquareAppModule);
|
||||
|
@ -87,10 +110,11 @@ public class BitsquareApp extends Application {
|
|||
|
||||
// load the main view and create the main scene
|
||||
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
|
||||
MainView view = (MainView) viewLoader.load(MainView.class);
|
||||
view.setExitHandler(this::stop);
|
||||
mainView = (MainView) viewLoader.load(MainView.class);
|
||||
mainView.setExitHandler(this::stop);
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
|
||||
scene = new Scene(view.getRoot(), 1000, 650);
|
||||
scene = new Scene(mainView.getRoot(), 1000, 650);
|
||||
scene.getStylesheets().setAll(
|
||||
"/io/bitsquare/gui/bitsquare.css",
|
||||
"/io/bitsquare/gui/images.css");
|
||||
|
@ -135,8 +159,37 @@ public class BitsquareApp extends Application {
|
|||
|
||||
//TODO just temp.
|
||||
//showDebugWindow();
|
||||
} catch (Throwable t) {
|
||||
Popups.openExceptionPopup(t);
|
||||
} catch (Throwable throwable) {
|
||||
showErrorPopup(throwable, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void showErrorPopup(Throwable throwable, boolean doShutDown) {
|
||||
if (scene == null) {
|
||||
scene = new Scene(new StackPane(), 1000, 650);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
try {
|
||||
throwable.printStackTrace();
|
||||
Dialogs.create()
|
||||
.owner(primaryStage)
|
||||
.title("")
|
||||
.message("")
|
||||
.masthead("")
|
||||
.showException(throwable);
|
||||
if (doShutDown)
|
||||
stop();
|
||||
} catch (Throwable throwable2) {
|
||||
// If printStackTrace cause a further exception we don't pass the throwable to the Popup.
|
||||
Dialogs.create()
|
||||
.owner(primaryStage)
|
||||
.title("Error")
|
||||
.message(throwable.toString())
|
||||
.masthead("A fatal exception occurred at startup.")
|
||||
.showError();
|
||||
if (doShutDown)
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BitsquareAppMain extends BitsquareExecutable {
|
|||
String updatesDirectory = bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY);
|
||||
|
||||
Logging.setup(Paths.get(bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "bitsquare").toString());
|
||||
|
||||
|
||||
// app dir need to be setup before UpdateFX bootstrap
|
||||
initAppDir(updatesDirectory);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class BitsquareAppModule extends BitsquareModule {
|
|||
|
||||
File storageDir = new File(env.getRequiredProperty(Storage.DIR_KEY));
|
||||
bind(File.class).annotatedWith(named(Storage.DIR_KEY)).toInstance(storageDir);
|
||||
|
||||
|
||||
File keyStorageDir = new File(env.getRequiredProperty(KeyStorage.DIR_KEY));
|
||||
bind(File.class).annotatedWith(named(KeyStorage.DIR_KEY)).toInstance(keyStorageDir);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.gui.common.view.View;
|
||||
import io.bitsquare.gui.common.view.ViewPath;
|
||||
import io.bitsquare.gui.main.MainView;
|
||||
|
@ -36,7 +37,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class Navigation implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
transient private static final Logger log = LoggerFactory.getLogger(Navigation.class);
|
||||
|
||||
transient private static final ViewPath DEFAULT_VIEW_PATH = ViewPath.to(MainView.class, BuyOfferView.class);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package io.bitsquare.gui.common.view;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -26,7 +28,7 @@ import java.util.List;
|
|||
|
||||
public class ViewPath extends ArrayList<Class<? extends View>> implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
public ViewPath() {
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ import io.bitsquare.gui.main.portfolio.PortfolioView;
|
|||
import io.bitsquare.gui.main.settings.SettingsView;
|
||||
import io.bitsquare.gui.util.Transitions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
@ -80,6 +82,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
private Label blockchainSyncLabel;
|
||||
private Label updateInfoLabel;
|
||||
private Runnable exitHandler;
|
||||
private List<String> persistedFilesCorrupted;
|
||||
|
||||
@Inject
|
||||
public MainView(MainViewModel model, CachingViewLoader viewLoader, Navigation navigation, OverlayManager overlayManager, Transitions transitions,
|
||||
|
@ -170,6 +173,15 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
|
||||
navigation.navigateToPreviousVisitedView();
|
||||
|
||||
if (!persistedFilesCorrupted.isEmpty()) {
|
||||
// show warning that some files has been corrupted
|
||||
Popups.openWarningPopup("Those data base file(s) are not compatible with our current code base." +
|
||||
"\n" + persistedFilesCorrupted.toString() +
|
||||
"\n\nWe made a backup of the corrupted file(s) and applied the default values." +
|
||||
"\n\nThe backup is located at: [data directory]/db/corrupted"
|
||||
);
|
||||
}
|
||||
|
||||
transitions.fadeOutAndRemove(splashScreen, 1500, actionEvent -> disposeSplashScreen());
|
||||
}
|
||||
});
|
||||
|
@ -182,6 +194,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
this.exitHandler = exitHandler;
|
||||
}
|
||||
|
||||
public void setPersistedFilesCorrupted(List<String> persistedFilesCorrupted) {
|
||||
this.persistedFilesCorrupted = persistedFilesCorrupted;
|
||||
}
|
||||
|
||||
private VBox createSplashScreen() {
|
||||
VBox vBox = new VBox();
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class WithdrawalView extends ActivatableViewAndModel {
|
|||
private final ObservableList<WithdrawalListItem> addressList = FXCollections.observableArrayList();
|
||||
|
||||
@Inject
|
||||
private WithdrawalView(WalletService walletService, TradeManager tradeManager, OpenOfferManager openOfferManager, BSFormatter formatter) {
|
||||
private WithdrawalView(WalletService walletService, TradeManager tradeManager, OpenOfferManager openOfferManager, BSFormatter formatter) {
|
||||
this.walletService = walletService;
|
||||
this.tradeManager = tradeManager;
|
||||
this.openOfferManager = openOfferManager;
|
||||
|
|
|
@ -163,7 +163,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
}
|
||||
|
||||
@FXML
|
||||
void createOffer() {
|
||||
void createOffer() {
|
||||
if (model.isRegistered()) {
|
||||
createOfferButton.setDisable(true);
|
||||
offerActionHandler.createOffer(model.getAmountAsCoin(), model.getPriceAsCoin());
|
||||
|
|
|
@ -34,6 +34,7 @@ class OpenOfferListItem {
|
|||
public OpenOffer getOpenOffer() {
|
||||
return openOffer;
|
||||
}
|
||||
|
||||
public Offer getOffer() {
|
||||
return openOffer.getOffer();
|
||||
}
|
||||
|
|
|
@ -196,9 +196,9 @@ public class ComponentBuilder {
|
|||
}
|
||||
|
||||
public static ButtonWithProgressIndicatorAndLabel getAndAddButtonWithStatus(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String ButtonTitle,
|
||||
EventHandler<ActionEvent> onActionHandler) {
|
||||
int rowIndex,
|
||||
String ButtonTitle,
|
||||
EventHandler<ActionEvent> onActionHandler) {
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
Button button = new Button(ButtonTitle);
|
||||
|
|
Loading…
Add table
Reference in a new issue