mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
LegacyAddress: Deprecate getHash160().
This commit is contained in:
parent
e11119b64f
commit
c0d8039c82
@ -186,7 +186,8 @@ public class LegacyAddress extends Address {
|
|||||||
return Base58.encodeChecked(getVersion(), bytes);
|
return Base58.encodeChecked(getVersion(), bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The (big endian) 20 byte hash that is the core of a Bitcoin address. */
|
/** @deprecated use {@link #getHash()} */
|
||||||
|
@Deprecated
|
||||||
public byte[] getHash160() {
|
public byte[] getHash160() {
|
||||||
return getHash();
|
return getHash();
|
||||||
}
|
}
|
||||||
|
@ -261,13 +261,13 @@ public class ScriptBuilder {
|
|||||||
// OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
// OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
||||||
builder.op(OP_DUP);
|
builder.op(OP_DUP);
|
||||||
builder.op(OP_HASH160);
|
builder.op(OP_HASH160);
|
||||||
builder.data(toLegacy.getHash160());
|
builder.data(toLegacy.getHash());
|
||||||
builder.op(OP_EQUALVERIFY);
|
builder.op(OP_EQUALVERIFY);
|
||||||
builder.op(OP_CHECKSIG);
|
builder.op(OP_CHECKSIG);
|
||||||
} else if (scriptType == ScriptType.P2SH) {
|
} else if (scriptType == ScriptType.P2SH) {
|
||||||
// OP_HASH160 <scriptHash> OP_EQUAL
|
// OP_HASH160 <scriptHash> OP_EQUAL
|
||||||
builder.op(OP_HASH160);
|
builder.op(OP_HASH160);
|
||||||
builder.data(toLegacy.getHash160());
|
builder.data(toLegacy.getHash());
|
||||||
builder.op(OP_EQUAL);
|
builder.op(OP_EQUAL);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Cannot handle " + scriptType);
|
throw new IllegalStateException("Cannot handle " + scriptType);
|
||||||
|
@ -429,7 +429,7 @@ public class LevelDBFullPrunedBlockStore implements FullPrunedBlockStore {
|
|||||||
for (LegacyAddress a : addresses) {
|
for (LegacyAddress a : addresses) {
|
||||||
ByteBuffer bb = ByteBuffer.allocate(21);
|
ByteBuffer bb = ByteBuffer.allocate(21);
|
||||||
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal());
|
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal());
|
||||||
bb.put(a.getHash160());
|
bb.put(a.getHash());
|
||||||
|
|
||||||
ReadOptions ro = new ReadOptions();
|
ReadOptions ro = new ReadOptions();
|
||||||
Snapshot sn = db.getSnapshot();
|
Snapshot sn = db.getSnapshot();
|
||||||
@ -443,7 +443,7 @@ public class LevelDBFullPrunedBlockStore implements FullPrunedBlockStore {
|
|||||||
bbKey.get(); // remove the address_hashindex byte.
|
bbKey.get(); // remove the address_hashindex byte.
|
||||||
byte[] addressKey = new byte[20];
|
byte[] addressKey = new byte[20];
|
||||||
bbKey.get(addressKey);
|
bbKey.get(addressKey);
|
||||||
if (!Arrays.equals(addressKey, a.getHash160())) {
|
if (!Arrays.equals(addressKey, a.getHash())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
byte[] hashBytes = new byte[32];
|
byte[] hashBytes = new byte[32];
|
||||||
@ -802,7 +802,7 @@ public class LevelDBFullPrunedBlockStore implements FullPrunedBlockStore {
|
|||||||
}
|
}
|
||||||
ByteBuffer bb = ByteBuffer.allocate(57);
|
ByteBuffer bb = ByteBuffer.allocate(57);
|
||||||
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal());
|
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal());
|
||||||
bb.put(a.getHash160());
|
bb.put(a.getHash());
|
||||||
bb.put(out.getHash().getBytes());
|
bb.put(out.getHash().getBytes());
|
||||||
bb.putInt((int) out.getIndex());
|
bb.putInt((int) out.getIndex());
|
||||||
byte[] value = new byte[0];
|
byte[] value = new byte[0];
|
||||||
@ -887,10 +887,10 @@ public class LevelDBFullPrunedBlockStore implements FullPrunedBlockStore {
|
|||||||
if (address == null || address.equals("")) {
|
if (address == null || address.equals("")) {
|
||||||
Script sc = out.getScript();
|
Script sc = out.getScript();
|
||||||
a = sc.getToAddress(params);
|
a = sc.getToAddress(params);
|
||||||
hashBytes = a.getHash160();
|
hashBytes = a.getHash();
|
||||||
} else {
|
} else {
|
||||||
a = LegacyAddress.fromBase58(params, out.getAddress());
|
a = LegacyAddress.fromBase58(params, out.getAddress());
|
||||||
hashBytes = a.getHash160();
|
hashBytes = a.getHash();
|
||||||
}
|
}
|
||||||
} catch (AddressFormatException e) {
|
} catch (AddressFormatException e) {
|
||||||
if (instrument)
|
if (instrument)
|
||||||
|
@ -358,7 +358,7 @@ public class KeyChainGroup implements KeyBag {
|
|||||||
|
|
||||||
public void markP2SHAddressAsUsed(LegacyAddress address) {
|
public void markP2SHAddressAsUsed(LegacyAddress address) {
|
||||||
checkArgument(address.isP2SHAddress());
|
checkArgument(address.isP2SHAddress());
|
||||||
RedeemData data = findRedeemDataFromScriptHash(address.getHash160());
|
RedeemData data = findRedeemDataFromScriptHash(address.getHash());
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return; // Not our P2SH address.
|
return; // Not our P2SH address.
|
||||||
for (ECKey key : data.keys) {
|
for (ECKey key : data.keys) {
|
||||||
|
@ -70,10 +70,10 @@ public class LegacyAddressTest {
|
|||||||
@Test
|
@Test
|
||||||
public void decoding() throws Exception {
|
public void decoding() throws Exception {
|
||||||
LegacyAddress a = LegacyAddress.fromBase58(TESTNET, "n4eA2nbYqErp7H6jebchxAN59DmNpksexv");
|
LegacyAddress a = LegacyAddress.fromBase58(TESTNET, "n4eA2nbYqErp7H6jebchxAN59DmNpksexv");
|
||||||
assertEquals("fda79a24e50ff70ff42f7d89585da5bd19d9e5cc", Utils.HEX.encode(a.getHash160()));
|
assertEquals("fda79a24e50ff70ff42f7d89585da5bd19d9e5cc", Utils.HEX.encode(a.getHash()));
|
||||||
|
|
||||||
LegacyAddress b = LegacyAddress.fromBase58(MAINNET, "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");
|
LegacyAddress b = LegacyAddress.fromBase58(MAINNET, "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");
|
||||||
assertEquals("4a22c3c4cbb31e4d03b15550636762bda0baf85a", Utils.HEX.encode(b.getHash160()));
|
assertEquals("4a22c3c4cbb31e4d03b15550636762bda0baf85a", Utils.HEX.encode(b.getHash()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -88,7 +88,7 @@ public class BitcoinURITest {
|
|||||||
assertNotNull(testObject);
|
assertNotNull(testObject);
|
||||||
assertNull("Unexpected amount", testObject.getAmount());
|
assertNull("Unexpected amount", testObject.getAmount());
|
||||||
assertNull("Unexpected label", testObject.getLabel());
|
assertNull("Unexpected label", testObject.getLabel());
|
||||||
assertEquals("Unexpected label", 20, testObject.getAddress().getHash160().length);
|
assertEquals("Unexpected label", 20, testObject.getAddress().getHash().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +75,7 @@ public class DeterministicKeyChainTest {
|
|||||||
final LegacyAddress address = LegacyAddress.fromBase58(UNITTEST, "n1bQNoEx8uhmCzzA5JPG6sFdtsUQhwiQJV");
|
final LegacyAddress address = LegacyAddress.fromBase58(UNITTEST, "n1bQNoEx8uhmCzzA5JPG6sFdtsUQhwiQJV");
|
||||||
assertEquals(address, LegacyAddress.fromKey(UNITTEST, key1));
|
assertEquals(address, LegacyAddress.fromKey(UNITTEST, key1));
|
||||||
assertEquals("mnHUcqUVvrfi5kAaXJDQzBb9HsWs78b42R", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
assertEquals("mnHUcqUVvrfi5kAaXJDQzBb9HsWs78b42R", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
||||||
assertEquals(key1, chain.findKeyFromPubHash(address.getHash160()));
|
assertEquals(key1, chain.findKeyFromPubHash(address.getHash()));
|
||||||
assertEquals(key2, chain.findKeyFromPubKey(key2.getPubKey()));
|
assertEquals(key2, chain.findKeyFromPubKey(key2.getPubKey()));
|
||||||
|
|
||||||
key1.sign(Sha256Hash.ZERO_HASH);
|
key1.sign(Sha256Hash.ZERO_HASH);
|
||||||
@ -106,7 +106,7 @@ public class DeterministicKeyChainTest {
|
|||||||
final LegacyAddress address = LegacyAddress.fromBase58(UNITTEST, "n2nHHRHs7TiZScTuVhZUkzZfTfVgGYwy6X");
|
final LegacyAddress address = LegacyAddress.fromBase58(UNITTEST, "n2nHHRHs7TiZScTuVhZUkzZfTfVgGYwy6X");
|
||||||
assertEquals(address, LegacyAddress.fromKey(UNITTEST, key1));
|
assertEquals(address, LegacyAddress.fromKey(UNITTEST, key1));
|
||||||
assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
||||||
assertEquals(key1, chain1.findKeyFromPubHash(address.getHash160()));
|
assertEquals(key1, chain1.findKeyFromPubHash(address.getHash()));
|
||||||
assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey()));
|
assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey()));
|
||||||
|
|
||||||
key1.sign(Sha256Hash.ZERO_HASH);
|
key1.sign(Sha256Hash.ZERO_HASH);
|
||||||
@ -165,7 +165,7 @@ public class DeterministicKeyChainTest {
|
|||||||
|
|
||||||
ECKey key2 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
ECKey key2 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", LegacyAddress.fromKey(UNITTEST, key2).toString());
|
||||||
assertEquals(key1, chain1.findKeyFromPubHash(address.getHash160()));
|
assertEquals(key1, chain1.findKeyFromPubHash(address.getHash()));
|
||||||
assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey()));
|
assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey()));
|
||||||
|
|
||||||
key1.sign(Sha256Hash.ZERO_HASH);
|
key1.sign(Sha256Hash.ZERO_HASH);
|
||||||
|
@ -202,7 +202,7 @@ public class KeyChainGroupTest {
|
|||||||
|
|
||||||
// test our script hash
|
// test our script hash
|
||||||
LegacyAddress address = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress address = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
RedeemData redeemData = group.findRedeemDataFromScriptHash(address.getHash160());
|
RedeemData redeemData = group.findRedeemDataFromScriptHash(address.getHash());
|
||||||
assertNotNull(redeemData);
|
assertNotNull(redeemData);
|
||||||
assertNotNull(redeemData.redeemScript);
|
assertNotNull(redeemData.redeemScript);
|
||||||
assertEquals(2, redeemData.keys.size());
|
assertEquals(2, redeemData.keys.size());
|
||||||
@ -332,7 +332,7 @@ public class KeyChainGroupTest {
|
|||||||
public void findRedeemScriptFromPubHash() throws Exception {
|
public void findRedeemScriptFromPubHash() throws Exception {
|
||||||
group = createMarriedKeyChainGroup();
|
group = createMarriedKeyChainGroup();
|
||||||
LegacyAddress address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertTrue(group.findRedeemDataFromScriptHash(address.getHash160()) != null);
|
assertTrue(group.findRedeemDataFromScriptHash(address.getHash()) != null);
|
||||||
group.getBloomFilterElementCount();
|
group.getBloomFilterElementCount();
|
||||||
KeyChainGroup group2 = createMarriedKeyChainGroup();
|
KeyChainGroup group2 = createMarriedKeyChainGroup();
|
||||||
group2.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
group2.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
@ -340,9 +340,9 @@ public class KeyChainGroupTest {
|
|||||||
// test address from lookahead zone and lookahead threshold zone
|
// test address from lookahead zone and lookahead threshold zone
|
||||||
for (int i = 0; i < group.getLookaheadSize() + group.getLookaheadThreshold(); i++) {
|
for (int i = 0; i < group.getLookaheadSize() + group.getLookaheadThreshold(); i++) {
|
||||||
address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertTrue(group2.findRedeemDataFromScriptHash(address.getHash160()) != null);
|
assertTrue(group2.findRedeemDataFromScriptHash(address.getHash()) != null);
|
||||||
}
|
}
|
||||||
assertFalse(group2.findRedeemDataFromScriptHash(group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS).getHash160()) != null);
|
assertFalse(group2.findRedeemDataFromScriptHash(group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS).getHash()) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -354,18 +354,18 @@ public class KeyChainGroupTest {
|
|||||||
LegacyAddress address1 = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress address1 = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertEquals(expected, group.getBloomFilterElementCount());
|
assertEquals(expected, group.getBloomFilterElementCount());
|
||||||
BloomFilter filter = group.getBloomFilter(expected + 2, 0.001, (long)(Math.random() * Long.MAX_VALUE));
|
BloomFilter filter = group.getBloomFilter(expected + 2, 0.001, (long)(Math.random() * Long.MAX_VALUE));
|
||||||
assertTrue(filter.contains(address1.getHash160()));
|
assertTrue(filter.contains(address1.getHash()));
|
||||||
|
|
||||||
LegacyAddress address2 = group.freshAddress(KeyChain.KeyPurpose.CHANGE);
|
LegacyAddress address2 = group.freshAddress(KeyChain.KeyPurpose.CHANGE);
|
||||||
assertTrue(filter.contains(address2.getHash160()));
|
assertTrue(filter.contains(address2.getHash()));
|
||||||
|
|
||||||
// Check that the filter contains the lookahead buffer.
|
// Check that the filter contains the lookahead buffer.
|
||||||
for (int i = 0; i < bufferSize - 1 /* issued address */; i++) {
|
for (int i = 0; i < bufferSize - 1 /* issued address */; i++) {
|
||||||
LegacyAddress address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress address = group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertTrue("key " + i, filter.contains(address.getHash160()));
|
assertTrue("key " + i, filter.contains(address.getHash()));
|
||||||
}
|
}
|
||||||
// We ran ahead of the lookahead buffer.
|
// We ran ahead of the lookahead buffer.
|
||||||
assertFalse(filter.contains(group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS).getHash160()));
|
assertFalse(filter.contains(group.freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS).getHash()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -581,7 +581,7 @@ public class KeyChainGroupTest {
|
|||||||
LegacyAddress addr1 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress addr1 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
LegacyAddress addr2 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress addr2 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertEquals(addr1, addr2);
|
assertEquals(addr1, addr2);
|
||||||
group.markPubKeyHashAsUsed(addr1.getHash160());
|
group.markPubKeyHashAsUsed(addr1.getHash());
|
||||||
LegacyAddress addr3 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
LegacyAddress addr3 = group.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
assertNotEquals(addr2, addr3);
|
assertNotEquals(addr2, addr3);
|
||||||
}
|
}
|
||||||
|
@ -1764,7 +1764,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
createMarriedWallet(2, 2);
|
createMarriedWallet(2, 2);
|
||||||
LegacyAddress address = wallet.currentReceiveAddress();
|
LegacyAddress address = wallet.currentReceiveAddress();
|
||||||
|
|
||||||
assertTrue(wallet.getBloomFilter(0.001).contains(address.getHash160()));
|
assertTrue(wallet.getBloomFilter(0.001).contains(address.getHash()));
|
||||||
|
|
||||||
Transaction t1 = createFakeTx(UNITTEST, CENT, address);
|
Transaction t1 = createFakeTx(UNITTEST, CENT, address);
|
||||||
TransactionOutPoint outPoint = new TransactionOutPoint(UNITTEST, 0, t1);
|
TransactionOutPoint outPoint = new TransactionOutPoint(UNITTEST, 0, t1);
|
||||||
@ -2929,7 +2929,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
assertEquals(THREE_CENTS.subtract(tx.getFee()), tx.getValueSentToMe(wallet));
|
assertEquals(THREE_CENTS.subtract(tx.getFee()), tx.getValueSentToMe(wallet));
|
||||||
// TX sends to one of our addresses (for now we ignore married wallets).
|
// TX sends to one of our addresses (for now we ignore married wallets).
|
||||||
final LegacyAddress toAddress = tx.getOutput(0).getScriptPubKey().getToAddress(UNITTEST);
|
final LegacyAddress toAddress = tx.getOutput(0).getScriptPubKey().getToAddress(UNITTEST);
|
||||||
final ECKey rotatingToKey = wallet.findKeyFromPubHash(toAddress.getHash160());
|
final ECKey rotatingToKey = wallet.findKeyFromPubHash(toAddress.getHash());
|
||||||
assertNotNull(rotatingToKey);
|
assertNotNull(rotatingToKey);
|
||||||
assertFalse(wallet.isKeyRotating(rotatingToKey));
|
assertFalse(wallet.isKeyRotating(rotatingToKey));
|
||||||
assertEquals(3, tx.getInputs().size());
|
assertEquals(3, tx.getInputs().size());
|
||||||
@ -2969,7 +2969,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
// Make a normal spend and check it's all ok.
|
// Make a normal spend and check it's all ok.
|
||||||
wallet.sendCoins(broadcaster, OTHER_ADDRESS, wallet.getBalance());
|
wallet.sendCoins(broadcaster, OTHER_ADDRESS, wallet.getBalance());
|
||||||
tx = broadcaster.waitForTransaction();
|
tx = broadcaster.waitForTransaction();
|
||||||
assertArrayEquals(OTHER_ADDRESS.getHash160(), tx.getOutput(0).getScriptPubKey().getPubKeyHash());
|
assertArrayEquals(OTHER_ADDRESS.getHash(), tx.getOutput(0).getScriptPubKey().getPubKeyHash());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Wallet roundTrip(Wallet wallet) throws UnreadableWalletException {
|
private Wallet roundTrip(Wallet wallet) throws UnreadableWalletException {
|
||||||
@ -3036,7 +3036,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
List<Transaction> txns = wallet.doMaintenance(null, false).get();
|
List<Transaction> txns = wallet.doMaintenance(null, false).get();
|
||||||
assertEquals(1, txns.size());
|
assertEquals(1, txns.size());
|
||||||
LegacyAddress output = txns.get(0).getOutput(0).getAddressFromP2PKHScript(UNITTEST);
|
LegacyAddress output = txns.get(0).getOutput(0).getAddressFromP2PKHScript(UNITTEST);
|
||||||
ECKey usedKey = wallet.findKeyFromPubHash(output.getHash160());
|
ECKey usedKey = wallet.findKeyFromPubHash(output.getHash());
|
||||||
assertEquals(goodKey.getCreationTimeSeconds(), usedKey.getCreationTimeSeconds());
|
assertEquals(goodKey.getCreationTimeSeconds(), usedKey.getCreationTimeSeconds());
|
||||||
assertEquals(goodKey.getCreationTimeSeconds(), wallet.freshReceiveKey().getCreationTimeSeconds());
|
assertEquals(goodKey.getCreationTimeSeconds(), wallet.freshReceiveKey().getCreationTimeSeconds());
|
||||||
assertEquals("mrM3TpCnav5YQuVA1xLercCGJH4DXujMtv", LegacyAddress.fromKey(UNITTEST, usedKey).toString());
|
assertEquals("mrM3TpCnav5YQuVA1xLercCGJH4DXujMtv", LegacyAddress.fromKey(UNITTEST, usedKey).toString());
|
||||||
|
@ -1465,7 +1465,7 @@ public class WalletTool {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
LegacyAddress address = LegacyAddress.fromBase58(wallet.getParams(), addr);
|
LegacyAddress address = LegacyAddress.fromBase58(wallet.getParams(), addr);
|
||||||
key = wallet.findKeyFromPubHash(address.getHash160());
|
key = wallet.findKeyFromPubHash(address.getHash());
|
||||||
} catch (AddressFormatException e) {
|
} catch (AddressFormatException e) {
|
||||||
System.err.println(addr + " does not parse as a Bitcoin address of the right network parameters.");
|
System.err.println(addr + " does not parse as a Bitcoin address of the right network parameters.");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user