@@ -155,6 +155,35 @@ def run_test(self):
155155
156156 self .node_simple : TestNode = self .nodes [1 ]
157157
158+ self .log .info ("Test input validation for masternode address fields" )
159+ self .test_validation_common ()
160+
161+ self .log .info ("Test output masternode address fields for consistency" )
162+ self .test_deprecation ()
163+
164+ def test_validation_common (self ):
165+ # Arrays of addresses with invalid inputs get refused
166+ self .node_evo .register_mn (self , False , [[f"127.0.0.1:{ self .node_evo .mn .nodePort } " ]],
167+ DEFAULT_PORT_PLATFORM_P2P , DEFAULT_PORT_PLATFORM_HTTP ,
168+ - 8 , "Invalid param for coreP2PAddrs[0], must be string" )
169+ self .node_evo .register_mn (self , False , [f"127.0.0.1:{ self .node_evo .mn .nodePort } " , "" ],
170+ DEFAULT_PORT_PLATFORM_P2P , DEFAULT_PORT_PLATFORM_HTTP ,
171+ - 8 , "Invalid param for coreP2PAddrs[1], cannot be empty string" )
172+ self .node_evo .register_mn (self , False , [f"127.0.0.1:{ self .node_evo .mn .nodePort } " , self .node_evo .mn .nodePort ],
173+ DEFAULT_PORT_PLATFORM_P2P , DEFAULT_PORT_PLATFORM_HTTP ,
174+ - 8 , "Invalid param for coreP2PAddrs[1], must be string" )
175+
176+ # platformP2PPort and platformHTTPPort must be within acceptable range (i.e. a valid port number)
177+ self .node_evo .register_mn (self , False , f"127.0.0.1:{ self .node_evo .mn .nodePort } " , "0" , DEFAULT_PORT_PLATFORM_HTTP ,
178+ - 8 , "platformP2PPort must be a valid port [1-65535]" )
179+ self .node_evo .register_mn (self , False , f"127.0.0.1:{ self .node_evo .mn .nodePort } " , "65536" , DEFAULT_PORT_PLATFORM_HTTP ,
180+ - 8 , "platformP2PPort must be a valid port [1-65535]" )
181+ self .node_evo .register_mn (self , False , f"127.0.0.1:{ self .node_evo .mn .nodePort } " , DEFAULT_PORT_PLATFORM_P2P , "0" ,
182+ - 8 , "platformHTTPPort must be a valid port [1-65535]" )
183+ self .node_evo .register_mn (self , False , f"127.0.0.1:{ self .node_evo .mn .nodePort } " , DEFAULT_PORT_PLATFORM_P2P , "65536" ,
184+ - 8 , "platformHTTPPort must be a valid port [1-65535]" )
185+
186+ def test_deprecation (self ):
158187 # netInfo is represented with JSON in CProRegTx, CProUpServTx, CDeterministicMNState and CSimplifiedMNListEntry,
159188 # so we need to test calls that rely on these underlying implementations. Start by collecting RPC responses.
160189 self .log .info ("Collect JSON RPC responses from node" )
0 commit comments