@@ -33,21 +33,26 @@ def __init__(self):
3333 def add_options (self , parser ):
3434 parser .add_option ("--parent_binpath" , dest = "parent_binpath" , default = "" ,
3535 help = "Use a different binary for launching nodes" )
36- parser .add_option ("--parent_bitcoin " , dest = "parent_bitcoin " , default = False , action = "store_true " ,
37- help = "Parent nodes are Bitcoin " )
36+ parser .add_option ("--parent_type " , dest = "parent_type " , default = "elements " ,
37+ help = "Type of parent nodes {elements, bitcoin} " )
3838
3939 def setup_network (self , split = False ):
40- if self .options .parent_bitcoin and self .options .parent_binpath == "" :
41- raise Exception ("Can't run with --parent_bitcoin without specifying --parent_binpath" )
4240 self .nodes = []
4341 self .extra_args = []
42+
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 )
45+
46+ if self .options .parent_type == 'bitcoin' and self .options .parent_binpath == "" :
47+ raise Exception ("Can't run with --parent_type=bitcoin without specifying --parent_binpath" )
48+
4449 # Parent chain args
4550 for n in range (2 ):
4651 # We want to test the rpc cookie method so we force the use of a
4752 # dummy conf file to avoid loading rpcuser/rpcpassword lines
4853 use_cookie_auth = n == 1
4954 rpc_u , rpc_p = rpc_auth_pair (n )
50- if self .options .parent_bitcoin :
55+ if self .options .parent_type == 'bitcoin' :
5156 self .parent_chain = 'regtest'
5257 self .extra_args .append ([
5358 "-conf=dummy" ,
@@ -78,7 +83,7 @@ def setup_network(self, split=False):
7883 connect_nodes_bi (self .nodes , 0 , 1 )
7984 self .parentgenesisblockhash = self .nodes [0 ].getblockhash (0 )
8085 print ('parentgenesisblockhash' , self .parentgenesisblockhash )
81- if not self .options .parent_bitcoin :
86+ if self .options .parent_type == 'elements' :
8287 parent_pegged_asset = self .nodes [0 ].getsidechaininfo ()['pegged_asset' ]
8388
8489 # Sidechain args
@@ -99,7 +104,7 @@ def setup_network(self, split=False):
99104 '-mainchainrpcport=%s' % rpc_port (n ),
100105 '-recheckpeginblockinterval=15' , # Long enough to allow failure and repair before timeout
101106 ]
102- if not self .options .parent_bitcoin :
107+ if self .options .parent_type == 'elements' :
103108 args .extend ([
104109 '-parentpubkeyprefix=235' ,
105110 '-parentscriptprefix=75' ,
0 commit comments