diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java index 93fb748b88..342bdfdd76 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java @@ -27,6 +27,7 @@ import bisq.core.dao.state.model.blockchain.TxType; import bisq.core.locale.Res; import bisq.core.util.coin.BsqFormatter; +import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.Transaction; @@ -34,15 +35,15 @@ import org.bitcoinj.core.TransactionOutput; import java.util.Date; -import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import static com.google.common.base.Preconditions.checkNotNull; @Slf4j @EqualsAndHashCode(callSuper = true) -@Data +@Getter class BsqTxListItem extends TxConfidenceListItem { private final DaoFacade daoFacade; private final BsqFormatter bsqFormatter; @@ -52,11 +53,9 @@ class BsqTxListItem extends TxConfidenceListItem { private final String address; private final String direction; - private Coin amount; + private final Coin amount; private boolean received; - private boolean issuanceTx; - BsqTxListItem(Transaction transaction, BsqWalletService bsqWalletService, BtcWalletService btcWalletService, @@ -103,18 +102,24 @@ class BsqTxListItem extends TxConfidenceListItem { WalletService.isOutputScriptConvertibleToAddress(output)) { // 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. - sendToAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) WalletService.getAddressFromOutput(output)); - break; + // We ignore segwit outputs + Address addressFromOutput = WalletService.getAddressFromOutput(output); + if (addressFromOutput instanceof LegacyAddress) { + sendToAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) addressFromOutput); + break; + } } } // 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. String receivedWithAddress = Res.get("shared.na"); - if (sendToAddress != null) { - for (TransactionOutput output : transaction.getOutputs()) { - if (WalletService.isOutputScriptConvertibleToAddress(output)) { - receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) WalletService.getAddressFromOutput(output)); + for (TransactionOutput output : transaction.getOutputs()) { + if (WalletService.isOutputScriptConvertibleToAddress(output)) { + Address addressFromOutput = WalletService.getAddressFromOutput(output); + // We ignore segwit outputs + if (addressFromOutput instanceof LegacyAddress) { + receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) addressFromOutput); break; } }