mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 06:35:17 +01:00
Wallet-template: Allow sending to Bech32 addresses.
This commit is contained in:
parent
be4245d2dd
commit
0d90157749
2 changed files with 4 additions and 3 deletions
|
@ -68,7 +68,7 @@ public class SendMoneyController {
|
|||
// Address exception cannot happen as we validated it beforehand.
|
||||
try {
|
||||
Coin amount = Coin.parseCoin(amountEdit.getText());
|
||||
LegacyAddress destination = LegacyAddress.fromBase58(Main.params, address.getText());
|
||||
Address destination = Address.fromString(Main.params, address.getText());
|
||||
SendRequest req;
|
||||
if (amount.equals(Main.bitcoin.wallet().getBalance()))
|
||||
req = SendRequest.emptyWallet(destination);
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
package wallettemplate.controls;
|
||||
|
||||
import org.bitcoinj.core.LegacyAddress;
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.AddressFormatException;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.TextField;
|
||||
import wallettemplate.utils.TextFieldValidator;
|
||||
|
@ -52,7 +53,7 @@ public class BitcoinAddressValidator {
|
|||
|
||||
private boolean testAddr(String text) {
|
||||
try {
|
||||
LegacyAddress.fromBase58(params, text);
|
||||
Address.fromString(params, text);
|
||||
return true;
|
||||
} catch (AddressFormatException e) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue