mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
fix error receiving a stowaway to postmix by reverting to master wallet
This commit is contained in:
parent
ea6b30326e
commit
e3799cd0a8
2 changed files with 18 additions and 8 deletions
|
@ -8,13 +8,9 @@ import com.samourai.wallet.cahoots.Cahoots;
|
||||||
import com.samourai.wallet.cahoots.CahootsType;
|
import com.samourai.wallet.cahoots.CahootsType;
|
||||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTParseException;
|
import com.sparrowwallet.drongo.psbt.PSBTParseException;
|
||||||
import com.sparrowwallet.drongo.wallet.BlockTransactionHashIndex;
|
import com.sparrowwallet.drongo.wallet.*;
|
||||||
import com.sparrowwallet.drongo.wallet.Status;
|
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
|
||||||
import com.sparrowwallet.drongo.wallet.WalletNode;
|
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.control.*;
|
import com.sparrowwallet.sparrow.control.*;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
|
||||||
import com.sparrowwallet.sparrow.paynym.PayNymDialog;
|
import com.sparrowwallet.sparrow.paynym.PayNymDialog;
|
||||||
import com.sparrowwallet.sparrow.paynym.PayNymService;
|
import com.sparrowwallet.sparrow.paynym.PayNymService;
|
||||||
import io.reactivex.rxjavafx.schedulers.JavaFxScheduler;
|
import io.reactivex.rxjavafx.schedulers.JavaFxScheduler;
|
||||||
|
@ -298,10 +294,20 @@ public class CounterpartyController extends SorobanController {
|
||||||
sorobanProgressLabel.setText("Creating mix transaction...");
|
sorobanProgressLabel.setText("Creating mix transaction...");
|
||||||
|
|
||||||
Soroban soroban = AppServices.getSorobanServices().getSoroban(walletId);
|
Soroban soroban = AppServices.getSorobanServices().getSoroban(walletId);
|
||||||
Map<BlockTransactionHashIndex, WalletNode> walletUtxos = wallet.getWalletUtxos();
|
Wallet counterpartyWallet;
|
||||||
|
if(counterpartyCahootsWallet.getAccount() == StandardAccount.WHIRLPOOL_POSTMIX.getAccountNumber() && cahootsType == CahootsType.STOWAWAY
|
||||||
|
&& !counterpartyCahootsWallet.getWallet().isMasterWallet()) {
|
||||||
|
//Counterparty cannot participate in Stowaway using Postmix wallet, switch to master wallet
|
||||||
|
counterpartyWallet = counterpartyCahootsWallet.getWallet().getMasterWallet();
|
||||||
|
counterpartyCahootsWallet = soroban.getCahootsWallet(counterpartyWallet, 1);
|
||||||
|
} else {
|
||||||
|
counterpartyWallet = wallet;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<BlockTransactionHashIndex, WalletNode> walletUtxos = counterpartyWallet.getWalletUtxos();
|
||||||
for(Map.Entry<BlockTransactionHashIndex, WalletNode> entry : walletUtxos.entrySet()) {
|
for(Map.Entry<BlockTransactionHashIndex, WalletNode> entry : walletUtxos.entrySet()) {
|
||||||
if(entry.getKey().getStatus() != Status.FROZEN) {
|
if(entry.getKey().getStatus() != Status.FROZEN) {
|
||||||
counterpartyCahootsWallet.addUtxo(entry.getValue(), wallet.getWalletTransaction(entry.getKey().getHash()), (int)entry.getKey().getIndex());
|
counterpartyCahootsWallet.addUtxo(entry.getValue(), counterpartyWallet.getWalletTransaction(entry.getKey().getHash()), (int)entry.getKey().getIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +331,7 @@ public class CounterpartyController extends SorobanController {
|
||||||
Transaction transaction = getTransaction(cahoots);
|
Transaction transaction = getTransaction(cahoots);
|
||||||
if(transaction != null) {
|
if(transaction != null) {
|
||||||
transactionProperty.set(transaction);
|
transactionProperty.set(transaction);
|
||||||
updateTransactionDiagram(transactionDiagram, wallet, null, transaction);
|
updateTransactionDiagram(transactionDiagram, counterpartyWallet, null, transaction);
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
} catch(PSBTParseException e) {
|
} catch(PSBTParseException e) {
|
||||||
|
|
|
@ -62,6 +62,10 @@ public class SparrowCahootsWallet extends SimpleCahootsWallet {
|
||||||
addUtxo(account, cahootsUtxo);
|
addUtxo(account, cahootsUtxo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Wallet getWallet() {
|
||||||
|
return wallet;
|
||||||
|
}
|
||||||
|
|
||||||
public int getAccount() {
|
public int getAccount() {
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue