mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Use Address.fromString() for btc addresses
Use Address.fromString() instead of LegacyAddress.fromBase58() for btc addresses. Trade protocol addresses not migrated yet.
This commit is contained in:
parent
87833fd3fc
commit
e8c82549a8
4 changed files with 9 additions and 7 deletions
|
@ -1058,7 +1058,7 @@ public class BtcWalletService extends WalletService {
|
|||
final Coin receiverAmount = amount.subtract(fee);
|
||||
Preconditions.checkArgument(Restrictions.isAboveDust(receiverAmount),
|
||||
"The amount is too low (dust limit).");
|
||||
tx.addOutput(receiverAmount, LegacyAddress.fromBase58(params, toAddress));
|
||||
tx.addOutput(receiverAmount, Address.fromString(params, toAddress));
|
||||
|
||||
SendRequest sendRequest = SendRequest.forTx(tx);
|
||||
sendRequest.fee = fee;
|
||||
|
@ -1089,7 +1089,7 @@ public class BtcWalletService extends WalletService {
|
|||
checkArgument(Restrictions.isAboveDust(netValue),
|
||||
"The amount is too low (dust limit).");
|
||||
|
||||
tx.addOutput(netValue, LegacyAddress.fromBase58(params, toAddress));
|
||||
tx.addOutput(netValue, Address.fromString(params, toAddress));
|
||||
|
||||
SendRequest sendRequest = SendRequest.forTx(tx);
|
||||
sendRequest.fee = fee;
|
||||
|
@ -1154,14 +1154,14 @@ public class BtcWalletService extends WalletService {
|
|||
Preconditions.checkArgument(Restrictions.isAboveDust(buyerAmount),
|
||||
"The buyerAmount is too low (dust limit).");
|
||||
|
||||
tx.addOutput(buyerAmount, LegacyAddress.fromBase58(params, buyerAddressString));
|
||||
tx.addOutput(buyerAmount, Address.fromString(params, buyerAddressString));
|
||||
}
|
||||
// sellerAmount can be 0
|
||||
if (sellerAmount.isPositive()) {
|
||||
Preconditions.checkArgument(Restrictions.isAboveDust(sellerAmount),
|
||||
"The sellerAmount is too low (dust limit).");
|
||||
|
||||
tx.addOutput(sellerAmount, LegacyAddress.fromBase58(params, sellerAddressString));
|
||||
tx.addOutput(sellerAmount, Address.fromString(params, sellerAddressString));
|
||||
}
|
||||
|
||||
SendRequest sendRequest = SendRequest.forTx(tx);
|
||||
|
|
|
@ -504,7 +504,7 @@ public abstract class WalletService {
|
|||
ResultHandler resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler)
|
||||
throws InsufficientMoneyException, AddressFormatException {
|
||||
SendRequest sendRequest = SendRequest.emptyWallet(LegacyAddress.fromBase58(params, toAddress));
|
||||
SendRequest sendRequest = SendRequest.emptyWallet(Address.fromString(params, toAddress));
|
||||
sendRequest.fee = Coin.ZERO;
|
||||
sendRequest.feePerKb = getTxFeeForWithdrawalPerByte().multiply(1000);
|
||||
sendRequest.aesKey = aesKey;
|
||||
|
|
|
@ -21,6 +21,7 @@ import bisq.core.locale.Res;
|
|||
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.AddressFormatException;
|
||||
import org.bitcoinj.core.LegacyAddress;
|
||||
|
||||
|
@ -44,7 +45,7 @@ public final class BtcAddressValidator extends InputValidator {
|
|||
|
||||
private ValidationResult validateBtcAddress(String input) {
|
||||
try {
|
||||
LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), input);
|
||||
Address.fromString(Config.baseCurrencyNetworkParameters(), input);
|
||||
return new ValidationResult(true);
|
||||
} catch (AddressFormatException e) {
|
||||
return new ValidationResult(false, Res.get("validation.btc.invalidFormat"));
|
||||
|
|
|
@ -68,6 +68,7 @@ import bisq.common.util.Tuple2;
|
|||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.LegacyAddress;
|
||||
import org.bitcoinj.core.TransactionConfidence;
|
||||
|
@ -718,7 +719,7 @@ public class GUIUtil {
|
|||
|
||||
public static String getBitcoinURI(String address, Coin amount, String label) {
|
||||
return address != null ?
|
||||
BitcoinURI.convertToBitcoinURI(LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(),
|
||||
BitcoinURI.convertToBitcoinURI(Address.fromString(Config.baseCurrencyNetworkParameters(),
|
||||
address), amount, label, null) :
|
||||
"";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue