Provide a consistent fromBase58/toBase58 API for the VersionChecksummedBytes hierarchy.

Deprecates the old constructors and migrates bitcoinj itself to use the new API. Also makes DumpedPrivateKey use WrongNetworkException when appropriate. Adds missing testcases and corrects/adds a bit of JavaDoc.
This commit is contained in:
Andreas Schildbach
2015-07-18 11:42:55 +02:00
parent 4112ed8005
commit 0441b38599
24 changed files with 162 additions and 93 deletions

View File

@@ -47,7 +47,7 @@ public class SendMoneyController {
// Address exception cannot happen as we validated it beforehand.
try {
Coin amount = Coin.parseCoin(amountEdit.getText());
Address destination = new Address(Main.params, address.getText());
Address destination = Address.fromBase58(Main.params, address.getText());
Wallet.SendRequest req;
if (amount.equals(Main.bitcoin.wallet().getBalance()))
req = Wallet.SendRequest.emptyWallet(destination);

View File

@@ -36,7 +36,7 @@ public class BitcoinAddressValidator {
private boolean testAddr(String text) {
try {
new Address(params, text);
Address.fromBase58(params, text);
return true;
} catch (AddressFormatException e) {
return false;