@@ -49,38 +49,38 @@ def setup_network(self, split=False):
4949 self .binary = self .options .parent_binpath if self .options .parent_binpath != "" else None
5050
5151 if self .options .parent_type == 'signet' :
52- from binascii import hexlify
53- from test_framework import script , key
54- from test_framework .util import hex_str_to_bytes
55- import shutil
56- temp_args = [
57- "-port=" + str (p2p_port (0 )),
58- "-rpcport=" + str (rpc_port (0 )),
59- "-addresstype=legacy" ,
60- "-deprecatedrpc=validateaddress"
61- ]
62- temp_node = start_node (0 , self .options .tmpdir , temp_args , binary = self .binary , chain = 'signet' , cookie_auth = True )
63- # raise Exception('aaa')
64- addr = temp_node .getnewaddress ()
65- k = key .CECKey ()
66- pub = temp_node .validateaddress (addr )["pubkey" ]
67- print ('pub' , pub )
68- k .set_pubkey (hex_str_to_bytes (pub ))
69- pubkey = key .CPubKey (k .get_pubkey ())
70- wif = temp_node .dumpprivkey (addr )
71- stop_node (temp_node , 0 )
72- datadir = os .path .join (self .options .tmpdir , 'node0' , 'signet' )
73- print ('datadir' , datadir )
74- shutil .rmtree (datadir )
75-
76- # import hashlib, random, codecs
77- # from test_framework import script, key, address
7852 # from binascii import hexlify
53+ # from test_framework import script, key
54+ # from test_framework.util import hex_str_to_bytes
55+ # import shutil
56+ # temp_args = [
57+ # "-port=" + str(p2p_port(0)),
58+ # "-rpcport=" + str(rpc_port(0)),
59+ # "-addresstype=legacy",
60+ # "-deprecatedrpc=validateaddress"
61+ # ]
62+ # temp_node = start_node(0, self.options.tmpdir, temp_args, binary=self.binary, chain='signet', cookie_auth=True)
63+ # # raise Exception('aaa')
64+ # addr = temp_node.getnewaddress()
7965 # k = key.CECKey()
80- # pk_bytes = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).digest()
81- # k.set_secretbytes(pk_bytes )
82- # wif = address.byte_to_base58(pk_bytes, 217 )
66+ # pub = temp_node.validateaddress(addr)["pubkey"]
67+ # print('pub', pub )
68+ # k.set_pubkey(hex_str_to_bytes(pub) )
8369 # pubkey = key.CPubKey(k.get_pubkey())
70+ # wif = temp_node.dumpprivkey(addr)
71+ # stop_node(temp_node, 0)
72+ # datadir = os.path.join(self.options.tmpdir, 'node0', 'signet')
73+ # print('datadir', datadir)
74+ # shutil.rmtree(datadir)
75+
76+ import hashlib , random , codecs
77+ from test_framework import script , key , address
78+ from binascii import hexlify
79+ k = key .CECKey ()
80+ pk_bytes = hashlib .sha256 (str (random .getrandbits (256 )).encode ('utf-8' )).digest ()
81+ k .set_secretbytes (pk_bytes )
82+ wif = address .byte_to_base58 (pk_bytes , 217 )
83+ pubkey = key .CPubKey (k .get_pubkey ())
8484 script = script .CScript ([pubkey , script .OP_CHECKSIG ])
8585 blockscript = hexlify (script ).decode ('ascii' )
8686 print ('blockscript' , blockscript )
@@ -351,11 +351,12 @@ def run_test(self):
351351 print ("Test pegout" )
352352 self .test_pegout (get_new_unconfidential_address (parent ), sidechain )
353353
354- print ("Test pegout P2SH" )
355- parent_chain_addr = get_new_unconfidential_address (parent )
356- parent_pubkey = parent .validateaddress (parent_chain_addr )["pubkey" ]
357- parent_chain_p2sh_addr = parent .createmultisig (1 , [parent_pubkey ])["address" ]
358- self .test_pegout (parent_chain_p2sh_addr , sidechain )
354+ if self .options .parent_type != 'signet' :
355+ print ("Test pegout P2SH" )
356+ parent_chain_addr = get_new_unconfidential_address (parent )
357+ parent_pubkey = parent .validateaddress (parent_chain_addr )["pubkey" ]
358+ parent_chain_p2sh_addr = parent .createmultisig (1 , [parent_pubkey ])["address" ]
359+ self .test_pegout (parent_chain_p2sh_addr , sidechain )
359360
360361 print ("Test pegout Garbage" )
361362 parent_chain_addr = "garbage"
0 commit comments