mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 22:46:56 +01:00
ScriptBuilder: Improve JavaDoc for the various P2SH helpers.
This commit is contained in:
parent
551b5a18f7
commit
6ee4faddb4
1 changed files with 18 additions and 4 deletions
|
@ -481,6 +481,9 @@ public class ScriptBuilder {
|
|||
* Creates a scriptPubKey that sends to the given script hash. Read
|
||||
* <a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki">BIP 16</a> to learn more about this
|
||||
* kind of script.
|
||||
*
|
||||
* @param hash The hash of the redeem script
|
||||
* @return an output script that sends to the redeem script
|
||||
*/
|
||||
public static Script createP2SHOutputScript(byte[] hash) {
|
||||
checkArgument(hash.length == 20);
|
||||
|
@ -488,7 +491,10 @@ public class ScriptBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a scriptPubKey for the given redeem script.
|
||||
* Creates a scriptPubKey for a given redeem script.
|
||||
*
|
||||
* @param redeemScript The redeem script
|
||||
* @return an output script that sends to the redeem script
|
||||
*/
|
||||
public static Script createP2SHOutputScript(Script redeemScript) {
|
||||
byte[] hash = Utils.sha256hash160(redeemScript.getProgram());
|
||||
|
@ -512,8 +518,12 @@ public class ScriptBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a P2SH output script with given public keys and threshold. Given public keys will be placed in
|
||||
* redeem script in the lexicographical sorting order.
|
||||
* Creates a P2SH output script for n-of-m multisig with given public keys and threshold. Given public keys will
|
||||
* be placed in redeem script in the lexicographical sorting order.
|
||||
*
|
||||
* @param threshold The threshold number of keys that must sign (n)
|
||||
* @param pubkeys A list of m public keys
|
||||
* @return The P2SH multisig output script
|
||||
*/
|
||||
public static Script createP2SHOutputScript(int threshold, List<ECKey> pubkeys) {
|
||||
Script redeemScript = createRedeemScript(threshold, pubkeys);
|
||||
|
@ -521,8 +531,12 @@ public class ScriptBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates redeem script with given public keys and threshold. Given public keys will be placed in
|
||||
* Creates an n-of-m multisig redeem script with given public keys and threshold. Given public keys will be placed in
|
||||
* redeem script in the lexicographical sorting order.
|
||||
*
|
||||
* @param threshold The threshold number of keys that must sign (n)
|
||||
* @param pubkeys A list of m public keys
|
||||
* @return The P2SH multisig redeem script
|
||||
*/
|
||||
public static Script createRedeemScript(int threshold, List<ECKey> pubkeys) {
|
||||
pubkeys = new ArrayList<>(pubkeys);
|
||||
|
|
Loading…
Add table
Reference in a new issue