mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-15 04:11:51 +01:00
ECKey: add JavaDoc for toAddress()
This commit is contained in:
parent
2223d38cad
commit
53cafe1b03
1 changed files with 7 additions and 0 deletions
|
@ -428,6 +428,13 @@ public class ECKey implements EncryptableItem {
|
||||||
return pub.isCompressed();
|
return pub.isCompressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an address that can receive outputs spendable with a signature from this key.
|
||||||
|
* @param scriptType A supported script type. ({@link ScriptType#P2PKH} or {@link ScriptType#P2WPKH})
|
||||||
|
* @param network Network type used to encode the address.
|
||||||
|
* @return address for this key.
|
||||||
|
* @throws IllegalArgumentException if unsupported script type or if key is uncompressed and {@code ScriptType.P2WPKH}.
|
||||||
|
*/
|
||||||
public Address toAddress(ScriptType scriptType, Network network) {
|
public Address toAddress(ScriptType scriptType, Network network) {
|
||||||
if (scriptType == ScriptType.P2PKH) {
|
if (scriptType == ScriptType.P2PKH) {
|
||||||
return LegacyAddress.fromPubKeyHash(network, this.getPubKeyHash());
|
return LegacyAddress.fromPubKeyHash(network, this.getPubKeyHash());
|
||||||
|
|
Loading…
Add table
Reference in a new issue