From 53cafe1b03a55447f92e52ae65f1af55128aaa6d Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Thu, 2 Jan 2025 10:30:47 -0800 Subject: [PATCH] ECKey: add JavaDoc for toAddress() --- core/src/main/java/org/bitcoinj/crypto/ECKey.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/main/java/org/bitcoinj/crypto/ECKey.java b/core/src/main/java/org/bitcoinj/crypto/ECKey.java index 821ac2054..6b5efa6dd 100644 --- a/core/src/main/java/org/bitcoinj/crypto/ECKey.java +++ b/core/src/main/java/org/bitcoinj/crypto/ECKey.java @@ -428,6 +428,13 @@ public class ECKey implements EncryptableItem { 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) { if (scriptType == ScriptType.P2PKH) { return LegacyAddress.fromPubKeyHash(network, this.getPubKeyHash());