Browse Source

bwt fixes and startup status

bwt
Craig Raw 4 years ago
parent
commit
3e083b907d
  1. 5
      src/main/java/com/sparrowwallet/sparrow/AppController.java
  2. 7
      src/main/java/com/sparrowwallet/sparrow/event/BwtBootStatusEvent.java
  3. 5
      src/main/java/com/sparrowwallet/sparrow/net/Bwt.java
  4. 7
      src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java
  5. BIN
      src/main/resources/native/osx/x64/libbwt_jni.dylib

5
src/main/java/com/sparrowwallet/sparrow/AppController.java

@ -1251,6 +1251,11 @@ public class AppController implements Initializable {
}
}
@Subscribe
public void bwtBootStatus(BwtBootStatusEvent event) {
statusUpdated(new StatusEvent(event.getStatus()));
}
@Subscribe
public void bwtSyncStatus(BwtSyncStatusEvent event) {
if((AppServices.isConnecting() || AppServices.isConnected()) && !event.isCompleted()) {

7
src/main/java/com/sparrowwallet/sparrow/event/BwtBootStatusEvent.java

@ -0,0 +1,7 @@
package com.sparrowwallet.sparrow.event;
public class BwtBootStatusEvent extends BwtStatusEvent {
public BwtBootStatusEvent(String status) {
super(status);
}
}

5
src/main/java/com/sparrowwallet/sparrow/net/Bwt.java

@ -198,6 +198,9 @@ public class Bwt {
@SerializedName("setup_logger")
public Boolean setupLogger;
@SerializedName("http_addr")
public String httpAddr;
}
public final class ConnectionService extends Service<Void> {
@ -220,7 +223,7 @@ public class Bwt {
public void onBooting() {
log.debug("Booting bwt");
if(!terminating) {
Platform.runLater(() -> EventManager.get().post(new BwtStatusEvent("Starting bwt")));
Platform.runLater(() -> EventManager.get().post(new BwtBootStatusEvent("Connecting to Bitcoin Core node at " + Config.get().getCoreServer() + "...")));
}
}

7
src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java

@ -14,11 +14,15 @@ import javafx.beans.property.IntegerProperty;
import javafx.beans.property.IntegerPropertyBase;
import javafx.beans.property.LongProperty;
import javafx.beans.property.LongPropertyBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
public class TransactionEntry extends Entry implements Comparable<TransactionEntry> {
private static final Logger log = LoggerFactory.getLogger(TransactionEntry.class);
private final BlockTransaction blockTransaction;
public TransactionEntry(Wallet wallet, BlockTransaction blockTransaction, Map<BlockTransactionHashIndex, KeyPurpose> inputs, Map<BlockTransactionHashIndex, KeyPurpose> outputs) {
@ -86,6 +90,7 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
if(optRef.isPresent()) {
validEntries++;
if(getChildren().stream().noneMatch(entry -> ((HashIndexEntry)entry).getHashIndex().equals(optRef.get().getSpentBy()) && ((HashIndexEntry)entry).getType().equals(HashIndexEntry.Type.INPUT))) {
log.warn("TransactionEntry " + blockTransaction.getHash() + " for wallet " + getWallet().getName() + " missing child for input " + optRef.get().getSpentBy() + " on output " + optRef.get());
return false;
}
}
@ -95,12 +100,14 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
if(optRef.isPresent()) {
validEntries++;
if(getChildren().stream().noneMatch(entry -> ((HashIndexEntry)entry).getHashIndex().equals(optRef.get()) && ((HashIndexEntry)entry).getType().equals(HashIndexEntry.Type.OUTPUT))) {
log.warn("TransactionEntry " + blockTransaction.getHash() + " for wallet " + getWallet().getName() + " missing child for output " + optRef.get());
return false;
}
}
}
if(getChildren().size() != validEntries) {
log.warn("TransactionEntry " + blockTransaction.getHash() + " for wallet " + getWallet().getName() + " has incorrect number of children " + getChildren().size() + " (should be " + validEntries + ")");
return false;
}

BIN
src/main/resources/native/osx/x64/libbwt_jni.dylib

Binary file not shown.
Loading…
Cancel
Save