@@ -14,7 +14,7 @@ class MnConfigLine (object):
1414
1515  def  __init__  (self , line ):
1616    parts  =  line .split  (" " )
17-     assert   len   (parts )  in  [ 5 ,  6 ] 
17+     assert_equal ( len (parts ),  5 ) 
1818
1919    self .line  =  line 
2020
@@ -24,21 +24,6 @@ def __init__ (self, line):
2424    self .txid  =  parts [3 ]
2525    self .vout  =  int  (parts [4 ])
2626
27-     if  len  (parts ) >=  6 :
28-       self .rewardAddr  =  parts [5 ]
29-     else :
30-       self .rewardAddr  =  None 
31- 
32-   def  getLine  (self ):
33-     """Returns the config line as string, to put into masternode.conf.""" 
34- 
35-     res  =  "%s %s %s %s %d"  %  (self .alias , self .ip , self .privkey ,
36-                               self .txid , self .vout )
37-     if  self .rewardAddr  is  not None :
38-       res  +=  " %s"  %  self .rewardAddr 
39- 
40-     return  res 
41- 
4227
4328def  fund_masternode  (node , alias , tier , txid , ip ):
4429  """Calls fundmasternode with the given data and returns the 
@@ -60,7 +45,7 @@ def __init__(self, setup_data,address=None):
6045    if  address  is  not None :
6146      self .address  =  address 
6247
63- def  setup_masternode (mempoolSync ,controlNode , hostNode ,alias ,tier ,hostIP , utxo  =  None ):
48+ def  setup_masternode (mempoolSync ,controlNode , hostNode ,alias ,tier ,hostIP , utxo  =  None ,  rewardAddr = "" ):
6449  """Calls fundmasternode with the given data and returns the 
6550  MnConfigLine instance.""" 
6651  txdata  =  None 
@@ -77,7 +62,7 @@ def setup_masternode(mempoolSync,controlNode, hostNode,alias,tier,hostIP, utxo =
7762  pubkey  =  controlNode .validateaddress (address )["pubkey" ]
7863  if  sync_required :
7964    mempoolSync ()
80-   data  =  hostNode .setupmasternode (alias ,txdata ["txhash" ],str (txdata ["vout" ]), pubkey , hostIP )
65+   data  =  hostNode .setupmasternode (alias ,txdata ["txhash" ],str (txdata ["vout" ]), pubkey , hostIP ,  rewardAddr )
8166  return  MnSetupData  (data ,address )
8267
8368class  MnTestFramework (BitcoinTestFramework ):
@@ -101,12 +86,12 @@ def for_each_masternode(self, masternode_function):
10186
10287    return  result 
10388
104-   def  setup_masternode (self ,controlNodeIndex , hostNodeIndex ,alias ,tier ,utxo = None ):
89+   def  setup_masternode (self ,controlNodeIndex , hostNodeIndex ,alias ,tier ,utxo = None ,  rewardAddr = "" ):
10590    def  mempoolSync ():
10691      sync_mempools  (self .nodes )
10792    controlNode  =  self .nodes [controlNodeIndex ]
10893    hostNode  =  self .nodes [hostNodeIndex ]
109-     self .setup [hostNodeIndex ] =  setup_masternode (mempoolSync ,controlNode ,hostNode ,alias , tier ,"localhost:%d"  %  p2p_port  (hostNodeIndex ),utxo = utxo )
94+     self .setup [hostNodeIndex ] =  setup_masternode (mempoolSync ,controlNode ,hostNode ,alias , tier ,"localhost:%d"  %  p2p_port  (hostNodeIndex ),utxo = utxo ,  rewardAddr = rewardAddr )
11095    self .mn_control_node_indices [alias ] =  controlNodeIndex 
11196    self .mn_host_node_indices [alias ] =  hostNodeIndex 
11297
@@ -201,7 +186,7 @@ def start_masternode(nodeIndex):
201186        args  =  self .args_for (nodeIndex )
202187        conf  =  self .setup [nodeIndex ].cfg 
203188        args .append  ("-masternode=%s"  %  conf .alias )
204-         self .nodes [nodeIndex ] =  start_node  (nodeIndex , self .options .tmpdir , extra_args = args , mn_config_lines = [conf .getLine () ])
189+         self .nodes [nodeIndex ] =  start_node  (nodeIndex , self .options .tmpdir , extra_args = args , mn_config_lines = [conf .line ])
205190        if  updateMockTime :
206191          set_node_times ([self .nodes [nodeIndex ]],self .time )
207192    self .for_each_masternode (start_masternode )
0 commit comments