@@ -33,21 +33,26 @@ def __init__(self):
33
33
def add_options (self , parser ):
34
34
parser .add_option ("--parent_binpath" , dest = "parent_binpath" , default = "" ,
35
35
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} " )
38
38
39
39
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" )
42
40
self .nodes = []
43
41
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
+
44
49
# Parent chain args
45
50
for n in range (2 ):
46
51
# We want to test the rpc cookie method so we force the use of a
47
52
# dummy conf file to avoid loading rpcuser/rpcpassword lines
48
53
use_cookie_auth = n == 1
49
54
rpc_u , rpc_p = rpc_auth_pair (n )
50
- if self .options .parent_bitcoin :
55
+ if self .options .parent_type == 'bitcoin' :
51
56
self .parent_chain = 'regtest'
52
57
self .extra_args .append ([
53
58
"-conf=dummy" ,
@@ -78,7 +83,7 @@ def setup_network(self, split=False):
78
83
connect_nodes_bi (self .nodes , 0 , 1 )
79
84
self .parentgenesisblockhash = self .nodes [0 ].getblockhash (0 )
80
85
print ('parentgenesisblockhash' , self .parentgenesisblockhash )
81
- if not self .options .parent_bitcoin :
86
+ if self .options .parent_type == 'elements' :
82
87
parent_pegged_asset = self .nodes [0 ].getsidechaininfo ()['pegged_asset' ]
83
88
84
89
# Sidechain args
@@ -99,7 +104,7 @@ def setup_network(self, split=False):
99
104
'-mainchainrpcport=%s' % rpc_port (n ),
100
105
'-recheckpeginblockinterval=15' , # Long enough to allow failure and repair before timeout
101
106
]
102
- if not self .options .parent_bitcoin :
107
+ if self .options .parent_type == 'elements' :
103
108
args .extend ([
104
109
'-parentpubkeyprefix=235' ,
105
110
'-parentscriptprefix=75' ,
0 commit comments