Merge pull request #4681 from oscarguindzberg/removeAddressClassFromBsqClasses

Use LegacyAddress instead of Address for BSQ
This commit is contained in:
sqrrm 2020-10-27 23:59:44 +01:00 committed by GitHub
commit 9a871373c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 9 deletions

View file

@ -774,12 +774,12 @@ public class BsqWalletService extends WalletService implements DaoStateListener
// Addresses
///////////////////////////////////////////////////////////////////////////////////////////
private Address getChangeAddress() {
private LegacyAddress getChangeAddress() {
return getUnusedAddress();
}
public Address getUnusedAddress() {
return wallet.getIssuedReceiveAddresses().stream()
public LegacyAddress getUnusedAddress() {
return (LegacyAddress) wallet.getIssuedReceiveAddresses().stream()
.filter(this::isAddressUnused)
.findAny()
.orElse(wallet.freshReceiveAddress());

View file

@ -27,7 +27,6 @@ import bisq.common.app.Version;
import bisq.common.config.Config;
import bisq.common.util.CollectionUtils;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.LegacyAddress;

View file

@ -27,7 +27,6 @@ import bisq.common.app.Version;
import bisq.common.config.Config;
import bisq.common.util.CollectionUtils;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.LegacyAddress;

View file

@ -31,7 +31,6 @@ import bisq.common.app.DevEnv;
import bisq.common.config.Config;
import bisq.common.util.MathUtils;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.LegacyAddress;
@ -97,7 +96,7 @@ public class BsqFormatter implements CoinFormatter {
* Returns the base-58 encoded String representation of this
* object, including version and checksum bytes.
*/
public String getBsqAddressStringFromAddress(Address address) {
public String getBsqAddressStringFromAddress(LegacyAddress address) {
final String addressString = address.toString();
if (useBsqAddressFormat)
return prefix + addressString;

View file

@ -28,6 +28,7 @@ import bisq.core.locale.Res;
import bisq.core.util.coin.BsqFormatter;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionOutput;
@ -102,7 +103,7 @@ 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(WalletService.getAddressFromOutput(output));
sendToAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) WalletService.getAddressFromOutput(output));
break;
}
}
@ -113,7 +114,7 @@ class BsqTxListItem extends TxConfidenceListItem {
if (sendToAddress != null) {
for (TransactionOutput output : transaction.getOutputs()) {
if (WalletService.isOutputScriptConvertibleToAddress(output)) {
receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress(WalletService.getAddressFromOutput(output));
receivedWithAddress = bsqFormatter.getBsqAddressStringFromAddress((LegacyAddress) WalletService.getAddressFromOutput(output));
break;
}
}