mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Check if output is a legacy address.
Remove `sendToAddress != null` check.
This commit is contained in:
parent
7c65000ff2
commit
b5f88c4932
@ -27,6 +27,7 @@ import bisq.core.dao.state.model.blockchain.TxType;
|
|||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.util.coin.BsqFormatter;
|
import bisq.core.util.coin.BsqFormatter;
|
||||||
|
|
||||||
|
import org.bitcoinj.core.Address;
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
import org.bitcoinj.core.LegacyAddress;
|
import org.bitcoinj.core.LegacyAddress;
|
||||||
import org.bitcoinj.core.Transaction;
|
import org.bitcoinj.core.Transaction;
|
||||||
@ -101,24 +102,24 @@ class BsqTxListItem extends TxConfidenceListItem {
|
|||||||
WalletService.isOutputScriptConvertibleToAddress(output)) {
|
WalletService.isOutputScriptConvertibleToAddress(output)) {
|
||||||
// We don't support send txs with multiple outputs to multiple receivers, so we can
|
// We don't support send txs with multiple outputs to multiple receivers, so we can
|
||||||
// assume that only one output is not from our own wallets.
|
// assume that only one output is not from our own wallets.
|
||||||
LegacyAddress addressFromOutput = (LegacyAddress) WalletService.getAddressFromOutput(output);
|
// We ignore segwit outputs
|
||||||
if (addressFromOutput != null) {
|
Address addressFromOutput = WalletService.getAddressFromOutput(output);
|
||||||
sendToAddress = bsqFormatter.getBsqAddressStringFromAddress(addressFromOutput);
|
if (addressFromOutput instanceof LegacyAddress) {
|
||||||
}
|
sendToAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) addressFromOutput);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// In the case we sent to ourselves (either to BSQ or BTC wallet) we show the first as the other is
|
// In the case we sent to ourselves (either to BSQ or BTC wallet) we show the first as the other is
|
||||||
// usually the change output.
|
// usually the change output.
|
||||||
String receivedWithAddress = Res.get("shared.na");
|
String receivedWithAddress = Res.get("shared.na");
|
||||||
if (sendToAddress != null) {
|
|
||||||
for (TransactionOutput output : transaction.getOutputs()) {
|
for (TransactionOutput output : transaction.getOutputs()) {
|
||||||
if (WalletService.isOutputScriptConvertibleToAddress(output)) {
|
if (WalletService.isOutputScriptConvertibleToAddress(output)) {
|
||||||
LegacyAddress addressFromOutput = (LegacyAddress) WalletService.getAddressFromOutput(output);
|
Address addressFromOutput = WalletService.getAddressFromOutput(output);
|
||||||
if (addressFromOutput != null) {
|
// We ignore segwit outputs
|
||||||
receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress(addressFromOutput);
|
if (addressFromOutput instanceof LegacyAddress) {
|
||||||
}
|
receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) addressFromOutput);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user