mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
Address: rename a static ctor method to be more accurate.
This commit is contained in:
parent
351299c9ab
commit
34e2d1596f
@ -56,7 +56,7 @@ public class Address extends VersionedChecksummedBytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an Address that represents the given P2SH script hash. */
|
/** Returns an Address that represents the given P2SH script hash. */
|
||||||
public static Address fromP2SHScript(NetworkParameters params, byte[] hash160) {
|
public static Address fromP2SHHash(NetworkParameters params, byte[] hash160) {
|
||||||
try {
|
try {
|
||||||
return new Address(params, params.getP2SHHeader(), hash160);
|
return new Address(params, params.getP2SHHeader(), hash160);
|
||||||
} catch (WrongNetworkException e) {
|
} catch (WrongNetworkException e) {
|
||||||
@ -67,7 +67,7 @@ public class Address extends VersionedChecksummedBytes {
|
|||||||
/** Returns an Address that represents the script hash extracted from the given scriptPubKey */
|
/** Returns an Address that represents the script hash extracted from the given scriptPubKey */
|
||||||
public static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey) {
|
public static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey) {
|
||||||
checkArgument(scriptPubKey.isPayToScriptHash(), "Not a P2SH script");
|
checkArgument(scriptPubKey.isPayToScriptHash(), "Not a P2SH script");
|
||||||
return fromP2SHScript(params, scriptPubKey.getPubKeyHash());
|
return fromP2SHHash(params, scriptPubKey.getPubKeyHash());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,9 +112,9 @@ public class AddressTest {
|
|||||||
|
|
||||||
// Test that we can convert them from hashes
|
// Test that we can convert them from hashes
|
||||||
byte[] hex = Hex.decode("2ac4b0b501117cc8119c5797b519538d4942e90e");
|
byte[] hex = Hex.decode("2ac4b0b501117cc8119c5797b519538d4942e90e");
|
||||||
Address a = Address.fromP2SHScript(mainParams, hex);
|
Address a = Address.fromP2SHHash(mainParams, hex);
|
||||||
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", a.toString());
|
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", a.toString());
|
||||||
Address b = Address.fromP2SHScript(testParams, Hex.decode("18a0e827269b5211eb51a4af1b2fa69333efa722"));
|
Address b = Address.fromP2SHHash(testParams, Hex.decode("18a0e827269b5211eb51a4af1b2fa69333efa722"));
|
||||||
assertEquals("2MuVSxtfivPKJe93EC1Tb9UhJtGhsoWEHCe", b.toString());
|
assertEquals("2MuVSxtfivPKJe93EC1Tb9UhJtGhsoWEHCe", b.toString());
|
||||||
Address c = Address.fromP2SHScript(mainParams, ScriptBuilder.createP2SHOutputScript(hex));
|
Address c = Address.fromP2SHScript(mainParams, ScriptBuilder.createP2SHOutputScript(hex));
|
||||||
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", c.toString());
|
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", c.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user