upgrade to whirlpool 1.0.0-beta13

- HttpException now differenciates HttpResponseException & HttpNetworkException
- MixFailReason.CANCEL becomes MixFailReason.STOP_UTXO. Also introduced NETWORK_ERROR, STOP_MIXING, ROTATE, and utilities such as .isError(), .isRequeue(), .isSilent()
This commit is contained in:
zeroleak 2024-03-12 17:46:39 +01:00
parent da74089969
commit 2647f5085f
6 changed files with 10 additions and 7 deletions

View file

@ -124,8 +124,8 @@ dependencies {
exclude group: 'org.slf4j' exclude group: 'org.slf4j'
} }
implementation('com.sparrowwallet.bokmakierie:bokmakierie:1.0') implementation('com.sparrowwallet.bokmakierie:bokmakierie:1.0')
implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.0-beta10') implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.0-beta13')
implementation('io.samourai.code.wallet:java-http-client:2.0.0-beta3') implementation('io.samourai.code.wallet:java-http-client:2.0.0-beta4')
implementation('io.reactivex.rxjava2:rxjava:2.2.15') implementation('io.reactivex.rxjava2:rxjava:2.2.15')
implementation('io.reactivex.rxjava2:rxjavafx:2.2.2') implementation('io.reactivex.rxjava2:rxjavafx:2.2.2')
implementation('org.apache.commons:commons-lang3:3.7') implementation('org.apache.commons:commons-lang3:3.7')

View file

@ -70,7 +70,7 @@ public class MixStatusCell extends TreeTableCell<Entry, UtxoEntry.MixStatus> {
} }
private void setMixFail(MixFailReason mixFailReason, String mixError, Long mixErrorTimestamp) { private void setMixFail(MixFailReason mixFailReason, String mixError, Long mixErrorTimestamp) {
if(mixFailReason != MixFailReason.CANCEL) { if(mixFailReason != MixFailReason.STOP_UTXO) {
long elapsed = mixErrorTimestamp == null ? 0L : System.currentTimeMillis() - mixErrorTimestamp; long elapsed = mixErrorTimestamp == null ? 0L : System.currentTimeMillis() - mixErrorTimestamp;
if(elapsed >= ERROR_DISPLAY_MILLIS) { if(elapsed >= ERROR_DISPLAY_MILLIS) {
//Old error, don't set again. //Old error, don't set again.

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.net;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.samourai.wallet.api.backend.beans.HttpException; import com.samourai.wallet.api.backend.beans.HttpException;
import com.samourai.wallet.httpClient.HttpResponseException;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.protocol.Sha256Hash; import com.sparrowwallet.drongo.protocol.Sha256Hash;
@ -158,7 +159,7 @@ public enum BroadcastSource {
} catch(Exception e) { } catch(Exception e) {
throw new BroadcastException("Could not retrieve txid from broadcast, server returned: " + response); throw new BroadcastException("Could not retrieve txid from broadcast, server returned: " + response);
} }
} catch(HttpException e) { } catch(HttpResponseException e) {
throw new BroadcastException("Could not broadcast transaction, server returned " + e.getStatusCode() + ": " + e.getResponseBody()); throw new BroadcastException("Could not broadcast transaction, server returned " + e.getStatusCode() + ": " + e.getResponseBody());
} catch(Exception e) { } catch(Exception e) {
log.error("Could not post transaction via " + getName(), e); log.error("Could not post transaction via " + getName(), e);

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.net; package com.sparrowwallet.sparrow.net;
import com.samourai.wallet.api.backend.beans.HttpException; import com.samourai.wallet.api.backend.beans.HttpException;
import com.samourai.wallet.httpClient.HttpResponseException;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.event.ExchangeRatesUpdatedEvent; import com.sparrowwallet.sparrow.event.ExchangeRatesUpdatedEvent;
import javafx.concurrent.ScheduledService; import javafx.concurrent.ScheduledService;
@ -107,7 +108,7 @@ public enum ExchangeSource {
if(log.isDebugEnabled()) { if(log.isDebugEnabled()) {
log.warn("Error retrieving historical currency rates", e); log.warn("Error retrieving historical currency rates", e);
} else { } else {
if(e instanceof HttpException httpException && httpException.getStatusCode() == 404) { if(e instanceof HttpResponseException httpException && httpException.getStatusCode() == 404) {
log.warn("Error retrieving historical currency rates (" + e.getMessage() + "). BTC-" + currency.getCurrencyCode() + " may not be supported by " + this); log.warn("Error retrieving historical currency rates (" + e.getMessage() + "). BTC-" + currency.getCurrencyCode() + " may not be supported by " + this);
} else { } else {
log.warn("Error retrieving historical currency rates (" + e.getMessage() + ")"); log.warn("Error retrieving historical currency rates (" + e.getMessage() + ")");

View file

@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.payjoin;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.samourai.wallet.api.backend.beans.HttpException; import com.samourai.wallet.api.backend.beans.HttpException;
import com.samourai.wallet.httpClient.HttpResponseException;
import com.sparrowwallet.drongo.protocol.Script; import com.sparrowwallet.drongo.protocol.Script;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.protocol.TransactionInput; import com.sparrowwallet.drongo.protocol.TransactionInput;
@ -87,7 +88,7 @@ public class Payjoin {
checkProposal(psbt, proposalPsbt, changeOutputIndex, maxAdditionalFeeContribution, allowOutputSubstitution); checkProposal(psbt, proposalPsbt, changeOutputIndex, maxAdditionalFeeContribution, allowOutputSubstitution);
return proposalPsbt; return proposalPsbt;
} catch(HttpException e) { } catch(HttpResponseException e) {
Gson gson = new Gson(); Gson gson = new Gson();
PayjoinReceiverError payjoinReceiverError = gson.fromJson(e.getResponseBody(), PayjoinReceiverError.class); PayjoinReceiverError payjoinReceiverError = gson.fromJson(e.getResponseBody(), PayjoinReceiverError.class);
log.warn("Payjoin receiver returned an error of " + payjoinReceiverError.getErrorCode() + " (" + payjoinReceiverError.getMessage() + ")"); log.warn("Payjoin receiver returned an error of " + payjoinReceiverError.getErrorCode() + " (" + payjoinReceiverError.getMessage() + ")");

View file

@ -43,7 +43,7 @@ public class MixTableCell extends TableCell {
private String getMixFail(UtxoEntry.MixStatus mixStatus) { private String getMixFail(UtxoEntry.MixStatus mixStatus) {
long elapsed = mixStatus.getMixErrorTimestamp() == null ? 0L : System.currentTimeMillis() - mixStatus.getMixErrorTimestamp(); long elapsed = mixStatus.getMixErrorTimestamp() == null ? 0L : System.currentTimeMillis() - mixStatus.getMixErrorTimestamp();
if(mixStatus.getMixFailReason() == MixFailReason.CANCEL || elapsed >= ERROR_DISPLAY_MILLIS) { if(mixStatus.getMixFailReason() == MixFailReason.STOP_UTXO || elapsed >= ERROR_DISPLAY_MILLIS) {
return getMixCountOnly(mixStatus); return getMixCountOnly(mixStatus);
} }