upgrade whirlpool-client 1.0.5

This commit is contained in:
zeroleak 2024-04-01 16:32:56 +02:00
parent 8e66db0237
commit 6ef1313137
5 changed files with 12 additions and 10 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.1') implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.5')
implementation('io.samourai.code.wallet:java-http-client:2.0.0') implementation('io.samourai.code.wallet:java-http-client:2.0.2')
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.STOP_UTXO && !mixFailReason.isSilent()) { if(mixFailReason.isError()) {
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

@ -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.STOP_UTXO || mixStatus.getMixFailReason().isSilent() || elapsed >= ERROR_DISPLAY_MILLIS) { if(mixStatus.getMixFailReason() == MixFailReason.STOP_UTXO || !mixStatus.getMixFailReason().isError() || elapsed >= ERROR_DISPLAY_MILLIS) {
return getMixCountOnly(mixStatus); return getMixCountOnly(mixStatus);
} }

View file

@ -52,7 +52,8 @@ public class SparrowDataSource extends AbstractDataSource {
super(whirlpoolWallet, bip44w, walletStateSupplier, dataSourceConfig); super(whirlpoolWallet, bip44w, walletStateSupplier, dataSourceConfig);
this.seenBackend = computeSeenBackend(whirlpoolWallet.getConfig()); this.seenBackend = computeSeenBackend(whirlpoolWallet.getConfig());
this.pushTx = computePushTx(); this.pushTx = computePushTx();
this.utxoSupplier = new SparrowUtxoSupplier(walletSupplier, utxoConfigSupplier, dataSourceConfig); NetworkParameters params = whirlpoolWallet.getConfig().getSamouraiNetwork().getParams();
this.utxoSupplier = new SparrowUtxoSupplier(walletSupplier, utxoConfigSupplier, dataSourceConfig, params);
} }
private ISeenBackend computeSeenBackend(WhirlpoolWalletConfig whirlpoolWalletConfig) { private ISeenBackend computeSeenBackend(WhirlpoolWalletConfig whirlpoolWalletConfig) {

View file

@ -16,6 +16,7 @@ import com.sparrowwallet.drongo.protocol.TransactionInput;
import com.sparrowwallet.drongo.protocol.TransactionOutput; import com.sparrowwallet.drongo.protocol.TransactionOutput;
import com.sparrowwallet.drongo.wallet.*; import com.sparrowwallet.drongo.wallet.*;
import com.sparrowwallet.sparrow.whirlpool.Whirlpool; import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
import org.bitcoinj.core.NetworkParameters;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -28,8 +29,9 @@ public class SparrowUtxoSupplier extends BasicUtxoSupplier {
public SparrowUtxoSupplier( public SparrowUtxoSupplier(
WalletSupplier walletSupplier, WalletSupplier walletSupplier,
UtxoConfigSupplier utxoConfigSupplier, UtxoConfigSupplier utxoConfigSupplier,
DataSourceConfig dataSourceConfig) { DataSourceConfig dataSourceConfig,
super(walletSupplier, utxoConfigSupplier, dataSourceConfig); NetworkParameters params) {
super(walletSupplier, utxoConfigSupplier, dataSourceConfig, params);
} }
@Override @Override
@ -120,13 +122,12 @@ public class SparrowUtxoSupplier extends BasicUtxoSupplier {
// update utxos // update utxos
UnspentOutput[] uos = unspentOutputs.toArray(new UnspentOutput[0]); UnspentOutput[] uos = unspentOutputs.toArray(new UnspentOutput[0]);
WalletResponse.Tx[] txs = txes.toArray(new WalletResponse.Tx[0]); WalletResponse.Tx[] txs = txes.toArray(new WalletResponse.Tx[0]);
UtxoData utxoData = new UtxoData(uos, txs); UtxoData utxoData = new UtxoData(uos, txs, storedBlockHeight);
setValue(utxoData); setValue(utxoData);
} }
@Override @Override
protected byte[] _getPrivKey(WhirlpoolUtxo whirlpoolUtxo) throws Exception { public byte[] _getPrivKeyBip47(UnspentOutput utxo) throws Exception {
UnspentOutput utxo = whirlpoolUtxo.getUtxo();
Wallet wallet = SparrowDataSource.getWallet(utxo.xpub.m); Wallet wallet = SparrowDataSource.getWallet(utxo.xpub.m);
Map<BlockTransactionHashIndex, WalletNode> walletUtxos = wallet.getWalletUtxos(); Map<BlockTransactionHashIndex, WalletNode> walletUtxos = wallet.getWalletUtxos();
WalletNode node = walletUtxos.entrySet().stream() WalletNode node = walletUtxos.entrySet().stream()