diff --git a/pycoin/cmds/keychain.py b/pycoin/cmds/keychain.py index a2fa80838..f7b3d47bf 100755 --- a/pycoin/cmds/keychain.py +++ b/pycoin/cmds/keychain.py @@ -53,7 +53,7 @@ def keychain(args, parser): total_paths = 0 - script_for_multisig = network.ui._script_info.script_for_multisig + script_for_multisig = network.script_info.script_for_multisig for path in subpaths_for_path_range(subkey_paths): if m: secs = sorted([_.subkey_for_path(path).sec() for _ in keys]) diff --git a/pycoin/networks/bitcoinish.py b/pycoin/networks/bitcoinish.py index f51383363..3b5b654ee 100644 --- a/pycoin/networks/bitcoinish.py +++ b/pycoin/networks/bitcoinish.py @@ -121,7 +121,7 @@ def f(public_pair): yield ("address_segwit", address_segwit, "%s segwit address" % network_name) yield ("%s_address_segwit" % network.symbol, address_segwit, "legacy") - p2sh_script = network.ui._script_info.script_for_p2pkh_wit(hash160_c) + p2sh_script = network.script_info.script_for_p2pkh_wit(hash160_c) p2s_address = network.ui.address_for_p2s(p2sh_script) if p2s_address: yield ("p2sh_segwit", p2s_address, None) diff --git a/tests/address_for_script_test.py b/tests/address_for_script_test.py index d89a649d7..82e6f6ac6 100644 --- a/tests/address_for_script_test.py +++ b/tests/address_for_script_test.py @@ -9,9 +9,9 @@ def make_tests_for_netcode(netcode): network = network_for_netcode(netcode) address_for_script = network.ui.address_for_script - script_for_p2pkh = network.ui._script_info.script_for_p2pkh - script_for_p2pk = network.ui._script_info.script_for_p2pk - script_for_nulldata = network.ui._script_info.script_for_nulldata + script_for_p2pkh = network.script_info.script_for_p2pkh + script_for_p2pk = network.script_info.script_for_p2pk + script_for_nulldata = network.script_info.script_for_nulldata Tx = network.tx Key = network.extras.Key diff --git a/tests/btc/segwit_test.py b/tests/btc/segwit_test.py index c26e14c1c..288ef654f 100644 --- a/tests/btc/segwit_test.py +++ b/tests/btc/segwit_test.py @@ -7,15 +7,15 @@ from pycoin.encoding.hexbytes import b2h, b2h_rev, h2b from pycoin.satoshi.flags import SIGHASH_ALL, SIGHASH_SINGLE, SIGHASH_NONE, SIGHASH_ANYONECANPAY from pycoin.solve.utils import build_hash160_lookup, build_p2sh_lookup -from pycoin.symbols.btc import network as BitcoinMainnet +from pycoin.symbols.btc import network # BRAIN DAMAGE -Key = BitcoinMainnet.extras.Key -Tx = BitcoinMainnet.tx -TxOut = BitcoinMainnet.tx.TxOut -script_for_p2pkh = BitcoinMainnet.ui._script_info.script_for_p2pkh -script_for_p2pkh_wit = BitcoinMainnet.ui._script_info.script_for_p2pkh_wit +Key = network.extras.Key +Tx = network.tx +TxOut = network.tx.TxOut +script_for_p2pkh = network.script_info.script_for_p2pkh +script_for_p2pkh_wit = network.script_info.script_for_p2pkh_wit class SegwitTest(unittest.TestCase): @@ -49,8 +49,8 @@ def check_tx_can_be_signed(self, tx_u, tx_s, private_keys=[], p2sh_values=[]): def test_segwit_ui(self): # p2wpkh address = 'bc1qqyykvamqq62n64t8gw09uw0cdgxjwwlw7mypam' - s = BitcoinMainnet.ui.script_for_address(address) - afs_address = BitcoinMainnet.ui.address_for_script(s) + s = network.ui.script_for_address(address) + afs_address = network.ui.address_for_script(s) self.assertEqual(address, afs_address) def test_segwit_create_tx(self): @@ -68,8 +68,8 @@ def test_segwit_create_tx(self): self.assertEqual(len(tx.txs_in[0].witness), 2) s1 = script_for_p2pkh(key1.hash160()) - address = BitcoinMainnet.ui.address_for_p2s_wit(s1) - spendable.script = BitcoinMainnet.ui.script_for_address(address) + address = network.ui.address_for_p2s_wit(s1) + spendable.script = network.ui.script_for_address(address) tx = create_tx([spendable], [(key2.address(), coin_value)]) self.check_unsigned(tx) sign_tx(tx, [key1.wif()], p2sh_lookup=build_p2sh_lookup([s1])) @@ -148,7 +148,7 @@ def test_bip143_tx_1(self): self.assertEqual(b2h(sc._hash_outputs(SIGHASH_ALL, 0)), "863ef3e1a92afbfdb97f31ad0fc7683ee943e9abcf2501590ff8f6551f47e5e5") - script = BitcoinMainnet.ui._script_info.script_for_p2pkh(tx_s1.unspents[1].script[2:]) + script = network.script_info.script_for_p2pkh(tx_s1.unspents[1].script[2:]) self.assertEqual( b2h(sc._segwit_signature_preimage(script=script, tx_in_idx=1, hash_type=SIGHASH_ALL)), "0100000096b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd" diff --git a/tests/multisig_individual_test.py b/tests/multisig_individual_test.py index 1d02c3183..aed448ac1 100644 --- a/tests/multisig_individual_test.py +++ b/tests/multisig_individual_test.py @@ -8,7 +8,7 @@ Key = network.extras.Key -script_for_multisig = network.ui._script_info.script_for_multisig +script_for_multisig = network.script_info.script_for_multisig Tx = network.tx diff --git a/tests/pay_to_test.py b/tests/pay_to_test.py index 29e3684bb..25205b7e1 100644 --- a/tests/pay_to_test.py +++ b/tests/pay_to_test.py @@ -7,10 +7,10 @@ # BRAIN DAMAGE -script_info_for_script = network.ui._script_info.info_for_script -script_for_multisig = network.ui._script_info.script_for_multisig -script_for_nulldata = network.ui._script_info.script_for_nulldata -script_for_nulldata_push = network.ui._script_info.script_for_nulldata_push +script_info_for_script = network.script_info.info_for_script +script_for_multisig = network.script_info.script_for_multisig +script_for_nulldata = network.script_info.script_for_nulldata +script_for_nulldata_push = network.script_info.script_for_nulldata_push Tx = network.tx diff --git a/tests/sign_test.py b/tests/sign_test.py index f95e820de..7918002b3 100644 --- a/tests/sign_test.py +++ b/tests/sign_test.py @@ -12,7 +12,7 @@ # BRAIN DAMAGE address_for_p2s = network.ui.address_for_p2s script_for_address = network.ui.script_for_address -script_for_multisig = network.ui._script_info.script_for_multisig +script_for_multisig = network.script_info.script_for_multisig Spendable = network.tx.Spendable Tx = network.tx diff --git a/tests/solver_test.py b/tests/solver_test.py index 0dc351c36..b75c1ccf5 100644 --- a/tests/solver_test.py +++ b/tests/solver_test.py @@ -11,8 +11,8 @@ address_for_p2s = network.ui.address_for_p2s script_for_address = network.ui.script_for_address -script_for_multisig = network.ui._script_info.script_for_multisig -script_for_p2pk = network.ui._script_info.script_for_p2pk +script_for_multisig = network.script_info.script_for_multisig +script_for_p2pk = network.script_info.script_for_p2pk # BRAIN DAMAGE Key = network.extras.Key diff --git a/tests/validation_test.py b/tests/validation_test.py index 1e73d3591..329aff5c4 100644 --- a/tests/validation_test.py +++ b/tests/validation_test.py @@ -239,32 +239,32 @@ def _make_tx(self, input_script, other_scripts=[]): return tx def test_validate_p2pkh(self): - us_1 = network.ui._script_info.script_for_p2pkh(self._key.hash160()) + us_1 = network.script_info.script_for_p2pkh(self._key.hash160()) tx = self._make_tx(us_1) tx.check_solution(0) def test_validate_p2s_of_p2pkh(self): - us_1 = network.ui._script_info.script_for_p2pkh(self._key.hash160()) - us_2 = network.ui._script_info.script_for_p2s(us_1) + us_1 = network.script_info.script_for_p2pkh(self._key.hash160()) + us_2 = network.script_info.script_for_p2s(us_1) tx = self._make_tx(us_2, [us_1]) tx.check_solution(0) def test_validate_p2pkh_wit(self): - us_1 = network.ui._script_info.script_for_p2pkh_wit(self._key.hash160()) + us_1 = network.script_info.script_for_p2pkh_wit(self._key.hash160()) tx = self._make_tx(us_1) tx.check_solution(0) def test_validate_p2s_wit_of_p2pkh(self): - us_1 = network.ui._script_info.script_for_p2pkh_wit(self._key.hash160()) - us_2 = network.ui._script_info.script_for_p2s(us_1) + us_1 = network.script_info.script_for_p2pkh_wit(self._key.hash160()) + us_2 = network.script_info.script_for_p2s(us_1) tx = self._make_tx(us_2, [us_1]) self.assertEqual(tx.id(), "1e5d967a3778bfa4e0d90f35f59530e8033a36bd7fd1d9e617c504054b89bd3a") tx.check_solution(0) def test_validate_p2s_of_p2s_wit_of_p2pkh(self): - us_1 = network.ui._script_info.script_for_p2pkh(self._key.hash160()) - us_2 = network.ui._script_info.script_for_p2s_wit(us_1) - us_3 = network.ui._script_info.script_for_p2s(us_2) + us_1 = network.script_info.script_for_p2pkh(self._key.hash160()) + us_2 = network.script_info.script_for_p2s_wit(us_1) + us_3 = network.script_info.script_for_p2s(us_2) tx = self._make_tx(us_3, [us_1, us_2]) self.assertEqual(tx.id(), "54a518b82b464744951531270c1bcec133c515fcdbe9d70c6141e067a62ff640") tx.check_solution(0) diff --git a/tests/who_signed_test.py b/tests/who_signed_test.py index 22de93250..3cfec3dc1 100644 --- a/tests/who_signed_test.py +++ b/tests/who_signed_test.py @@ -12,7 +12,7 @@ UI = network.ui address_for_p2s = UI.address_for_p2s script_for_address = UI.script_for_address -script_for_multisig = UI._script_info.script_for_multisig +script_for_multisig = network.script_info.script_for_multisig Key = UI._key_class Tx = network.tx