@@ -49,38 +49,38 @@ def setup_network(self, split=False):
49
49
self .binary = self .options .parent_binpath if self .options .parent_binpath != "" else None
50
50
51
51
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
78
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()
79
65
# 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) )
83
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
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 ())
84
84
script = script .CScript ([pubkey , script .OP_CHECKSIG ])
85
85
blockscript = hexlify (script ).decode ('ascii' )
86
86
print ('blockscript' , blockscript )
@@ -351,11 +351,12 @@ def run_test(self):
351
351
print ("Test pegout" )
352
352
self .test_pegout (get_new_unconfidential_address (parent ), sidechain )
353
353
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 )
359
360
360
361
print ("Test pegout Garbage" )
361
362
parent_chain_addr = "garbage"
0 commit comments