@@ -34,14 +34,14 @@ def add_options(self, parser):
3434        parser .add_option ("--parent_binpath" , dest = "parent_binpath" , default = "" ,
3535                          help = "Use a different binary for launching nodes" )
3636        parser .add_option ("--parent_type" , dest = "parent_type" , default = "elements" ,
37-                           help = "Type of parent nodes {elements, bitcoin}" )
37+                           help = "Type of parent nodes {elements, bitcoin, signet }" )
3838
3939    def  setup_network (self , split = False ):
4040        self .nodes  =  []
4141        self .extra_args  =  []
4242
43-         if  self .options .parent_type  not  in 'elements' , 'bitcoin' ]:
44-             raise  Exception ("Invalid option --parent_type=%s, valid options:  elements, bitcoin"  %  self .options .parent_type )
43+         if  self .options .parent_type  not  in 'elements' , 'bitcoin' ,  'signet' ]:
44+             raise  Exception ("Invalid option --parent_type=%s, valid values: { elements, bitcoin, signet} "  %  self .options .parent_type )
4545
4646        if  self .options .parent_type  ==  'bitcoin'  and  self .options .parent_binpath  ==  "" :
4747            raise  Exception ("Can't run with --parent_type=bitcoin without specifying --parent_binpath" )
@@ -62,7 +62,21 @@ def setup_network(self, split=False):
6262                    "-port=" + str (p2p_port (n )),
6363                    "-rpcport=" + str (rpc_port (n ))
6464                ])
65-             else :
65+             elif  self .options .parent_type  ==  'signet' :
66+                 self .parent_chain  =  'signet' 
67+                 rpc_u , rpc_p  =  rpc_auth_pair (n )
68+                 self .extra_args .append ([
69+                     "-printtoconsole=0" ,
70+                     "-signet_blockscript=4104db082f6133b7d9cdb7be60d8384c818ae61233c20485b438e8c1d7772b7f2dbdc04f2f7273d534df0e6a54c8b333994f6275bb921df2438e9a672438e4ed4969ac" ,
71+                     "-signet_siglen=77" ,
72+                     "-signet_seednode=178.128.221.177" ,
73+                     "-port="  +  str (p2p_port (n )),
74+                     "-rpcport="  +  str (rpc_port (n )),
75+                     "-addresstype=legacy" , # To make sure bitcoind gives back p2pkh no matter version 
76+                     "-deprecatedrpc=validateaddress" ,
77+                     "-fallbackfee=0.00001" ,
78+                 ])
79+             elif  self .options .parent_type  ==  'elements' :
6680                self .parent_chain  =  'parent' 
6781                self .extra_args .append ([
6882                    "-conf=dummy" ,
@@ -79,6 +93,8 @@ def setup_network(self, split=False):
7993
8094            self .binary  =  self .options .parent_binpath  if  self .options .parent_binpath  !=  ""  else  None 
8195            self .nodes .append (start_node (n , self .options .tmpdir , self .extra_args [n ], binary = self .binary , chain = self .parent_chain , cookie_auth = use_cookie_auth ))
96+             if  self .options .parent_type  ==  'signet' :
97+                 self .nodes [n ].importprivkey ('8Hh8jNjkx1aSCgEk3iq9Vo2APZUSDQJVt3rJ2BRpb5Tavqb68vW' )
8298
8399        connect_nodes_bi (self .nodes , 0 , 1 )
84100        self .parentgenesisblockhash  =  self .nodes [0 ].getblockhash (0 )
@@ -111,6 +127,14 @@ def setup_network(self, split=False):
111127                    '-con_parent_chain_signblockscript=%s'  %  parent_chain_signblockscript ,
112128                    '-con_parent_pegged_asset=%s'  %  parent_pegged_asset ,
113129                ])
130+             elif  self .options .parent_type  ==  'signet' :
131+                 args .extend ([
132+                     '-con_parent_is_signet=1' ,
133+                     '-con_parent_signet_siglen=77' ,
134+                     '-parentpubkeyprefix=125' ,
135+                     '-parentscriptprefix=87' ,
136+                     '-con_parent_chain_signblockscript=4104db082f6133b7d9cdb7be60d8384c818ae61233c20485b438e8c1d7772b7f2dbdc04f2f7273d534df0e6a54c8b333994f6275bb921df2438e9a672438e4ed4969ac' ,
137+                 ])
114138
115139            if  used_cookie_auth :
116140                # Need to specify where to find parent cookie file 
@@ -270,11 +294,13 @@ def run_test(self):
270294        print ("Test pegout" )
271295        self .test_pegout (get_new_unconfidential_address (parent ), sidechain )
272296
273-         print ("Test pegout P2SH" )
274-         parent_chain_addr  =  get_new_unconfidential_address (parent )
275-         parent_pubkey  =  parent .validateaddress (parent_chain_addr )["pubkey" ]
276-         parent_chain_p2sh_addr  =  parent .createmultisig (1 , [parent_pubkey ])["address" ]
277-         self .test_pegout (parent_chain_p2sh_addr , sidechain )
297+         # TODO Stop skipping this test once signet is rebased on top of 0.17 
298+         if  not  self .options .parent_type  ==  'signet' :
299+             print ("Test pegout P2SH" )
300+             parent_chain_addr  =  get_new_unconfidential_address (parent )
301+             parent_pubkey  =  parent .validateaddress (parent_chain_addr )["pubkey" ]
302+             parent_chain_p2sh_addr  =  parent .createmultisig (1 , [parent_pubkey ])["address" ]
303+             self .test_pegout (parent_chain_p2sh_addr , sidechain )
278304
279305        print ("Test pegout Garbage" )
280306        parent_chain_addr  =  "garbage" 
0 commit comments