Browse Source

Rename functions which create multisig scripts

master
chris-belcher 6 years ago
parent
commit
d86df334c3
No known key found for this signature in database
GPG Key ID: EF734EA677F31129
  1. 6
      jmbitcoin/jmbitcoin/secp256k1_transaction.py
  2. 4
      jmclient/test/test_tx_creation.py

6
jmbitcoin/jmbitcoin/secp256k1_transaction.py

@ -534,7 +534,7 @@ def pubkey_to_p2wpkh_address(pub):
script = pubkey_to_p2wpkh_script(pub)
return script_to_address(script)
def pubkeys_to_p2wsh_script(pubs):
def pubkeys_to_p2wsh_multisig_script(pubs):
""" Given a list of N pubkeys, constructs an N of N
multisig scriptPubKey of type pay-to-witness-script-hash.
No other scripts than N-N multisig supported as of now.
@ -543,12 +543,12 @@ def pubkeys_to_p2wsh_script(pubs):
script = mk_multisig_script(pubs, N)
return P2WSH_PRE + bin_sha256(binascii.unhexlify(script))
def pubkeys_to_p2wsh_address(pubs):
def pubkeys_to_p2wsh_multisig_address(pubs):
""" Given a list of N pubkeys, constructs an N of N
multisig address of type pay-to-witness-script-hash.
No other scripts than N-N multisig supported as of now.
"""
script = pubkeys_to_p2wsh_script(pubs)
script = pubkeys_to_p2wsh_multisig_script(pubs)
return script_to_address(script)
def deserialize_script(scriptinp):

4
jmclient/test/test_tx_creation.py

@ -244,8 +244,8 @@ def test_spend_p2wsh(setup_tx_creation):
privs = [binascii.hexlify(priv).decode('ascii') for priv in privs]
pubs = [bitcoin.privkey_to_pubkey(priv) for priv in privs]
redeemScripts = [bitcoin.mk_multisig_script(pubs[i:i+2], 2) for i in [0, 2]]
scriptPubKeys = [bitcoin.pubkeys_to_p2wsh_script(pubs[i:i+2]) for i in [0, 2]]
addresses = [bitcoin.pubkeys_to_p2wsh_address(pubs[i:i+2]) for i in [0, 2]]
scriptPubKeys = [bitcoin.pubkeys_to_p2wsh_multisig_script(pubs[i:i+2]) for i in [0, 2]]
addresses = [bitcoin.pubkeys_to_p2wsh_multisig_address(pubs[i:i+2]) for i in [0, 2]]
#pay into it
wallet_service = make_wallets(1, [[3, 0, 0, 0, 0]], 3)[0]['wallet']
wallet_service.sync_wallet(fast=True)

Loading…
Cancel
Save