Merge remote-tracking branch 'origin/DAO' into disk-protobuffer

Conflicts:
	core/src/main/java/io/bisq/core/dao/blockchain/BsqBlockchainManager.java
	core/src/main/java/io/bisq/core/dao/blockchain/BsqTXOMap.java
	core/src/main/java/io/bisq/core/dao/blockchain/BsqUTXOMap.java
	core/src/test/java/io/bisq/core/dao/blockchain/BsqBlockchainServiceTest.java
	gui/src/main/java/io/bisq/gui/main/dao/wallet/BalanceUtil.java
	gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java
This commit is contained in:
Mike Rosseel 2017-04-11 11:04:42 +02:00
parent ead174bba6
commit 3b09202fd0
3 changed files with 9 additions and 5 deletions

View File

@ -19,6 +19,7 @@ package io.bisq.core.dao.blockchain;
import com.google.inject.Inject;
import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.persistance.ProtobufferResolver;
import io.bisq.common.storage.Storage;
import io.bisq.core.app.BisqEnvironment;
import io.bisq.core.btc.BitcoinNetwork;
@ -88,13 +89,14 @@ public class BsqBlockchainManager {
public BsqBlockchainManager(BsqBlockchainService blockchainService,
BisqEnvironment bisqEnvironment,
JsonExporter jsonExporter,
ProtobufferResolver protobufferResolver,
@Named(Storage.DIR_KEY) File storageDir,
@Named(RpcOptionKeys.RPC_USER) String rpcUser) {
this.blockchainService = blockchainService;
this.jsonExporter = jsonExporter;
this.bitcoinNetwork = bisqEnvironment.getBitcoinNetwork();
connectToBtcCore = rpcUser != null && !rpcUser.isEmpty();
txOutputMap = new TxOutputMap(storageDir);
txOutputMap = new TxOutputMap(storageDir, protobufferResolver);
txOutputMap.addListener(bsqTxOutputMap -> onBsqTxoChanged());
}

View File

@ -17,6 +17,8 @@
package io.bisq.core.dao.blockchain;
import io.bisq.common.persistance.Persistable;
import io.bisq.common.persistance.ProtobufferResolver;
import io.bisq.common.storage.Storage;
import lombok.Getter;
import lombok.Setter;
@ -32,7 +34,7 @@ import java.util.List;
// Map of any ever existing TxOutput which was a valid BSQ
@Slf4j
public class TxOutputMap implements Serializable {
public class TxOutputMap implements Persistable {
///////////////////////////////////////////////////////////////////////////////////////////
// Interface
@ -62,8 +64,8 @@ public class TxOutputMap implements Serializable {
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public TxOutputMap(File storageDir) {
storage = new Storage<>(storageDir);
public TxOutputMap(File storageDir, ProtobufferResolver protobufferResolver) {
storage = new Storage<>(storageDir, protobufferResolver);
TxOutputMap persisted = storage.initAndGetPersisted(this, "BsqTxOutputMap");
if (persisted != null) {
map.putAll(persisted.getMap());

View File

@ -66,7 +66,7 @@ public class BsqBlockchainServiceTest {
final URL resource = this.getClass().getClassLoader().getResource("");
final String path = resource != null ? resource.getFile() : "";
log.info("path for BsqUTXOMap=" + path);
txOutputMap = new TxOutputMap(new File(path));
txOutputMap = new TxOutputMap(new File(path), null);
service = new MockBsqBlockchainService();
}