mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 20:11:23 +00:00
Address: Make main constructor private.
There is no reason to call it directly.
This commit is contained in:
@@ -51,11 +51,18 @@ public class Address extends VersionedChecksummedBytes {
|
||||
private transient NetworkParameters params;
|
||||
|
||||
/**
|
||||
* Construct an address from parameters, the address version, and the hash160 form. Example:<p>
|
||||
*
|
||||
* <pre>new Address(MainNetParams.get(), NetworkParameters.getAddressHeader(), Hex.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));</pre>
|
||||
* Private constructor. Use {@link #fromBase58(NetworkParameters, String)},
|
||||
* {@link #Address(NetworkParameters, byte[])}, {@link #fromP2SHHash(NetworkParameters, byte[])} or
|
||||
* {@link #fromKey(NetworkParameters, ECKey)}.
|
||||
*
|
||||
* @param params
|
||||
* network this address is valid for
|
||||
* @param version
|
||||
* version header of the address
|
||||
* @param hash160
|
||||
* 20-byte hash of pubkey or script
|
||||
*/
|
||||
public Address(NetworkParameters params, int version, byte[] hash160) throws WrongNetworkException {
|
||||
private Address(NetworkParameters params, int version, byte[] hash160) throws WrongNetworkException {
|
||||
super(version, hash160);
|
||||
checkNotNull(params);
|
||||
checkArgument(hash160.length == 20, "Addresses are 160-bit hashes, so you must provide 20 bytes");
|
||||
|
@@ -152,7 +152,7 @@ public class WalletTest extends TestWithWallet {
|
||||
|
||||
@Test
|
||||
public void basicSpendingToP2SH() throws Exception {
|
||||
Address destination = new Address(PARAMS, PARAMS.getP2SHHeader(), HEX.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));
|
||||
Address destination = Address.fromP2SHHash(PARAMS, HEX.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));
|
||||
basicSpendingCommon(wallet, myAddress, destination, null);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user