mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
bwt fixes and startup status
This commit is contained in:
parent
3c4b25ecee
commit
3e083b907d
5 changed files with 23 additions and 1 deletions
|
@ -1251,6 +1251,11 @@ public class AppController implements Initializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void bwtBootStatus(BwtBootStatusEvent event) {
|
||||||
|
statusUpdated(new StatusEvent(event.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void bwtSyncStatus(BwtSyncStatusEvent event) {
|
public void bwtSyncStatus(BwtSyncStatusEvent event) {
|
||||||
if((AppServices.isConnecting() || AppServices.isConnected()) && !event.isCompleted()) {
|
if((AppServices.isConnecting() || AppServices.isConnected()) && !event.isCompleted()) {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.sparrowwallet.sparrow.event;
|
||||||
|
|
||||||
|
public class BwtBootStatusEvent extends BwtStatusEvent {
|
||||||
|
public BwtBootStatusEvent(String status) {
|
||||||
|
super(status);
|
||||||
|
}
|
||||||
|
}
|
|
@ -198,6 +198,9 @@ public class Bwt {
|
||||||
|
|
||||||
@SerializedName("setup_logger")
|
@SerializedName("setup_logger")
|
||||||
public Boolean setupLogger;
|
public Boolean setupLogger;
|
||||||
|
|
||||||
|
@SerializedName("http_addr")
|
||||||
|
public String httpAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class ConnectionService extends Service<Void> {
|
public final class ConnectionService extends Service<Void> {
|
||||||
|
@ -220,7 +223,7 @@ public class Bwt {
|
||||||
public void onBooting() {
|
public void onBooting() {
|
||||||
log.debug("Booting bwt");
|
log.debug("Booting bwt");
|
||||||
if(!terminating) {
|
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() + "...")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,15 @@ import javafx.beans.property.IntegerProperty;
|
||||||
import javafx.beans.property.IntegerPropertyBase;
|
import javafx.beans.property.IntegerPropertyBase;
|
||||||
import javafx.beans.property.LongProperty;
|
import javafx.beans.property.LongProperty;
|
||||||
import javafx.beans.property.LongPropertyBase;
|
import javafx.beans.property.LongPropertyBase;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TransactionEntry extends Entry implements Comparable<TransactionEntry> {
|
public class TransactionEntry extends Entry implements Comparable<TransactionEntry> {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TransactionEntry.class);
|
||||||
|
|
||||||
private final BlockTransaction blockTransaction;
|
private final BlockTransaction blockTransaction;
|
||||||
|
|
||||||
public TransactionEntry(Wallet wallet, BlockTransaction blockTransaction, Map<BlockTransactionHashIndex, KeyPurpose> inputs, Map<BlockTransactionHashIndex, KeyPurpose> outputs) {
|
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()) {
|
if(optRef.isPresent()) {
|
||||||
validEntries++;
|
validEntries++;
|
||||||
if(getChildren().stream().noneMatch(entry -> ((HashIndexEntry)entry).getHashIndex().equals(optRef.get().getSpentBy()) && ((HashIndexEntry)entry).getType().equals(HashIndexEntry.Type.INPUT))) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,12 +100,14 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
|
||||||
if(optRef.isPresent()) {
|
if(optRef.isPresent()) {
|
||||||
validEntries++;
|
validEntries++;
|
||||||
if(getChildren().stream().noneMatch(entry -> ((HashIndexEntry)entry).getHashIndex().equals(optRef.get()) && ((HashIndexEntry)entry).getType().equals(HashIndexEntry.Type.OUTPUT))) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getChildren().size() != validEntries) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue