mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
show reason for mix error in tooltip
This commit is contained in:
parent
31f9cca33a
commit
712241873f
5 changed files with 24 additions and 9 deletions
|
@ -49,7 +49,7 @@ public class MixStatusCell extends TreeTableCell<Entry, UtxoEntry.MixStatus> {
|
||||||
if(mixStatus.getNextMixUtxo() != null) {
|
if(mixStatus.getNextMixUtxo() != null) {
|
||||||
setMixSuccess(mixStatus.getNextMixUtxo());
|
setMixSuccess(mixStatus.getNextMixUtxo());
|
||||||
} else if(mixStatus.getMixFailReason() != null) {
|
} else if(mixStatus.getMixFailReason() != null) {
|
||||||
setMixFail(mixStatus.getMixFailReason());
|
setMixFail(mixStatus.getMixFailReason(), mixStatus.getMixError());
|
||||||
} else if(mixStatus.getMixProgress() != null) {
|
} else if(mixStatus.getMixProgress() != null) {
|
||||||
setMixProgress(mixStatus.getMixProgress());
|
setMixProgress(mixStatus.getMixProgress());
|
||||||
} else {
|
} else {
|
||||||
|
@ -67,11 +67,11 @@ public class MixStatusCell extends TreeTableCell<Entry, UtxoEntry.MixStatus> {
|
||||||
setTooltip(tt);
|
setTooltip(tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMixFail(MixFailReason mixFailReason) {
|
private void setMixFail(MixFailReason mixFailReason, String mixError) {
|
||||||
if(mixFailReason != MixFailReason.CANCEL) {
|
if(mixFailReason != MixFailReason.CANCEL) {
|
||||||
setGraphic(getFailGlyph());
|
setGraphic(getFailGlyph());
|
||||||
Tooltip tt = new Tooltip();
|
Tooltip tt = new Tooltip();
|
||||||
tt.setText(mixFailReason.getMessage());
|
tt.setText(mixFailReason.getMessage() + (mixError == null ? "" : ": " + mixError));
|
||||||
setTooltip(tt);
|
setTooltip(tt);
|
||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class WhirlpoolMixEvent {
|
||||||
private final MixProgress mixProgress;
|
private final MixProgress mixProgress;
|
||||||
private final Utxo nextUtxo;
|
private final Utxo nextUtxo;
|
||||||
private final MixFailReason mixFailReason;
|
private final MixFailReason mixFailReason;
|
||||||
|
private final String mixError;
|
||||||
|
|
||||||
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, MixProgress mixProgress) {
|
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, MixProgress mixProgress) {
|
||||||
this.wallet = wallet;
|
this.wallet = wallet;
|
||||||
|
@ -19,6 +20,7 @@ public class WhirlpoolMixEvent {
|
||||||
this.mixProgress = mixProgress;
|
this.mixProgress = mixProgress;
|
||||||
this.nextUtxo = null;
|
this.nextUtxo = null;
|
||||||
this.mixFailReason = null;
|
this.mixFailReason = null;
|
||||||
|
this.mixError = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, Utxo nextUtxo) {
|
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, Utxo nextUtxo) {
|
||||||
|
@ -27,14 +29,16 @@ public class WhirlpoolMixEvent {
|
||||||
this.mixProgress = null;
|
this.mixProgress = null;
|
||||||
this.nextUtxo = nextUtxo;
|
this.nextUtxo = nextUtxo;
|
||||||
this.mixFailReason = null;
|
this.mixFailReason = null;
|
||||||
|
this.mixError = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, MixFailReason mixFailReason) {
|
public WhirlpoolMixEvent(Wallet wallet, BlockTransactionHashIndex utxo, MixFailReason mixFailReason, String mixError) {
|
||||||
this.wallet = wallet;
|
this.wallet = wallet;
|
||||||
this.utxo = utxo;
|
this.utxo = utxo;
|
||||||
this.mixProgress = null;
|
this.mixProgress = null;
|
||||||
this.nextUtxo = null;
|
this.nextUtxo = null;
|
||||||
this.mixFailReason = mixFailReason;
|
this.mixFailReason = mixFailReason;
|
||||||
|
this.mixError = mixError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wallet getWallet() {
|
public Wallet getWallet() {
|
||||||
|
@ -56,4 +60,8 @@ public class WhirlpoolMixEvent {
|
||||||
public MixFailReason getMixFailReason() {
|
public MixFailReason getMixFailReason() {
|
||||||
return mixFailReason;
|
return mixFailReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMixError() {
|
||||||
|
return mixError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class UtxoEntry extends HashIndexEntry {
|
||||||
mixStatusProperty().set(new MixStatus(mixProgress));
|
mixStatusProperty().set(new MixStatus(mixProgress));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMixFailReason(MixFailReason mixFailReason) {
|
public void setMixFailReason(MixFailReason mixFailReason, String mixError) {
|
||||||
mixStatusProperty().set(new MixStatus(mixFailReason));
|
mixStatusProperty().set(new MixStatus(mixFailReason, mixError));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNextMixUtxo(Utxo nextMixUtxo) {
|
public void setNextMixUtxo(Utxo nextMixUtxo) {
|
||||||
|
@ -126,6 +126,7 @@ public class UtxoEntry extends HashIndexEntry {
|
||||||
private MixProgress mixProgress;
|
private MixProgress mixProgress;
|
||||||
private Utxo nextMixUtxo;
|
private Utxo nextMixUtxo;
|
||||||
private MixFailReason mixFailReason;
|
private MixFailReason mixFailReason;
|
||||||
|
private String mixError;
|
||||||
|
|
||||||
public MixStatus(MixProgress mixProgress) {
|
public MixStatus(MixProgress mixProgress) {
|
||||||
this.mixProgress = mixProgress;
|
this.mixProgress = mixProgress;
|
||||||
|
@ -135,8 +136,9 @@ public class UtxoEntry extends HashIndexEntry {
|
||||||
this.nextMixUtxo = nextMixUtxo;
|
this.nextMixUtxo = nextMixUtxo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MixStatus(MixFailReason mixFailReason) {
|
public MixStatus(MixFailReason mixFailReason, String mixError) {
|
||||||
this.mixFailReason = mixFailReason;
|
this.mixFailReason = mixFailReason;
|
||||||
|
this.mixError = mixError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UtxoEntry getUtxoEntry() {
|
public UtxoEntry getUtxoEntry() {
|
||||||
|
@ -175,5 +177,9 @@ public class UtxoEntry extends HashIndexEntry {
|
||||||
public MixFailReason getMixFailReason() {
|
public MixFailReason getMixFailReason() {
|
||||||
return mixFailReason;
|
return mixFailReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMixError() {
|
||||||
|
return mixError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,7 @@ public class UtxosController extends WalletFormController implements Initializab
|
||||||
return Whirlpool.WHIRLPOOL_NETWORKS.contains(Network.get())
|
return Whirlpool.WHIRLPOOL_NETWORKS.contains(Network.get())
|
||||||
&& getWalletForm().getWallet().getKeystores().size() == 1
|
&& getWalletForm().getWallet().getKeystores().size() == 1
|
||||||
&& getWalletForm().getWallet().getKeystores().get(0).hasSeed()
|
&& getWalletForm().getWallet().getKeystores().get(0).hasSeed()
|
||||||
|
&& getWalletForm().getWallet().getKeystores().get(0).getSeed().getType() == DeterministicSeed.Type.BIP39
|
||||||
&& !getWalletForm().getWallet().isWhirlpoolMixWallet();
|
&& !getWalletForm().getWallet().isWhirlpoolMixWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +529,7 @@ public class UtxosController extends WalletFormController implements Initializab
|
||||||
if(event.getNextUtxo() != null) {
|
if(event.getNextUtxo() != null) {
|
||||||
utxoEntry.setNextMixUtxo(event.getNextUtxo());
|
utxoEntry.setNextMixUtxo(event.getNextUtxo());
|
||||||
} else if(event.getMixFailReason() != null) {
|
} else if(event.getMixFailReason() != null) {
|
||||||
utxoEntry.setMixFailReason(event.getMixFailReason());
|
utxoEntry.setMixFailReason(event.getMixFailReason(), event.getMixError());
|
||||||
} else {
|
} else {
|
||||||
utxoEntry.setMixProgress(event.getMixProgress());
|
utxoEntry.setMixProgress(event.getMixProgress());
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,7 +442,7 @@ public class Whirlpool {
|
||||||
WalletUtxo walletUtxo = getUtxo(e.getWhirlpoolUtxo());
|
WalletUtxo walletUtxo = getUtxo(e.getWhirlpoolUtxo());
|
||||||
if(walletUtxo != null) {
|
if(walletUtxo != null) {
|
||||||
log.debug("Mix failed for utxo " + e.getWhirlpoolUtxo().getUtxo().tx_hash + ":" + e.getWhirlpoolUtxo().getUtxo().tx_output_n + " " + e.getMixFailReason());
|
log.debug("Mix failed for utxo " + e.getWhirlpoolUtxo().getUtxo().tx_hash + ":" + e.getWhirlpoolUtxo().getUtxo().tx_output_n + " " + e.getMixFailReason());
|
||||||
Platform.runLater(() -> EventManager.get().post(new WhirlpoolMixEvent(walletUtxo.wallet, walletUtxo.utxo, e.getMixFailReason())));
|
Platform.runLater(() -> EventManager.get().post(new WhirlpoolMixEvent(walletUtxo.wallet, walletUtxo.utxo, e.getMixFailReason(), e.getError())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue