@@ -1242,6 +1242,11 @@ def register(self, node: TestNode, submit: bool, collateral_txid: Optional[str]
12421242 ]
12431243 address_funds = fundsAddr or self .fundsAddr
12441244
1245+ # Flip a coin and decide if we will submit the transaction directly or use sendrawtransaction
1246+ use_srt : bool = bool (random .getrandbits (1 )) and submit
1247+ if use_srt :
1248+ submit = False
1249+
12451250 # Construct final command and arguments
12461251 if self .evo :
12471252 command = "register_evo"
@@ -1250,7 +1255,11 @@ def register(self, node: TestNode, submit: bool, collateral_txid: Optional[str]
12501255 command = "register_legacy" if self .legacy else "register"
12511256 args = args + [address_funds , submit ] # type: ignore
12521257
1253- return node .protx (command , * args )
1258+ ret : str = node .protx (command , * args )
1259+ if use_srt :
1260+ ret = node .sendrawtransaction (ret )
1261+
1262+ return ret
12541263
12551264 def register_fund (self , node : TestNode , submit : bool , collateral_address : Optional [str ] = None , ipAndPort : Optional [str ] = None ,
12561265 ownerAddr : Optional [str ] = None , pubKeyOperator : Optional [str ] = None , votingAddr : Optional [str ] = None ,
@@ -1265,6 +1274,11 @@ def register_fund(self, node: TestNode, submit: bool, collateral_address: Option
12651274 if platform_http_port is None :
12661275 raise AssertionError ("EvoNode but platform_http_port is missing, must be specified!" )
12671276
1277+ # Flip a coin and decide if we will submit the transaction directly or use sendrawtransaction
1278+ use_srt : bool = bool (random .getrandbits (1 )) and submit
1279+ if use_srt :
1280+ submit = False
1281+
12681282 # Common arguments shared between regular masternodes and EvoNodes
12691283 args = [
12701284 collateral_address or self .collateral_address ,
@@ -1285,7 +1299,11 @@ def register_fund(self, node: TestNode, submit: bool, collateral_address: Option
12851299 command = "register_fund_legacy" if self .legacy else "register_fund"
12861300 args = args + [address_funds , submit ] # type: ignore
12871301
1288- return node .protx (command , * args )
1302+ ret : str = node .protx (command , * args )
1303+ if use_srt :
1304+ ret = node .sendrawtransaction (ret )
1305+
1306+ return ret
12891307
12901308 def revoke (self , node : TestNode , submit : bool , reason : int , fundsAddr : Optional [str ] = None ) -> str :
12911309 # Update commands should be run from the appropriate MasternodeInfo instance, we do not allow overriding some values for this reason
@@ -1294,6 +1312,11 @@ def revoke(self, node: TestNode, submit: bool, reason: int, fundsAddr: Optional[
12941312 if self .keyOperator is None :
12951313 raise AssertionError ("keyOperator not set, did you call generate_addresses()" )
12961314
1315+ # Flip a coin and decide if we will submit the transaction directly or use sendrawtransaction
1316+ use_srt : bool = bool (random .getrandbits (1 )) and submit and (fundsAddr is not None )
1317+ if use_srt :
1318+ submit = False
1319+
12971320 args = [
12981321 self .proTxHash ,
12991322 self .keyOperator ,
@@ -1306,14 +1329,23 @@ def revoke(self, node: TestNode, submit: bool, reason: int, fundsAddr: Optional[
13061329 elif submit is not True :
13071330 raise AssertionError ("Cannot withhold transaction if relying on fundsAddr fallback behavior" )
13081331
1309- return node .protx ('revoke' , * args )
1332+ ret : str = node .protx ('revoke' , * args )
1333+ if use_srt :
1334+ ret = node .sendrawtransaction (ret )
1335+
1336+ return ret
13101337
13111338 def update_registrar (self , node : TestNode , submit : bool , pubKeyOperator : Optional [str ] = None , votingAddr : Optional [str ] = None ,
13121339 rewards_address : Optional [str ] = None , fundsAddr : Optional [str ] = None ) -> str :
13131340 # Update commands should be run from the appropriate MasternodeInfo instance, we do not allow overriding proTxHash for this reason
13141341 if self .proTxHash is None :
13151342 raise AssertionError ("proTxHash not set, did you call set_params()" )
13161343
1344+ # Flip a coin and decide if we will submit the transaction directly or use sendrawtransaction
1345+ use_srt : bool = bool (random .getrandbits (1 )) and submit and (fundsAddr is not None )
1346+ if use_srt :
1347+ submit = False
1348+
13171349 command = 'update_registrar_legacy' if self .legacy else 'update_registrar'
13181350 args = [
13191351 self .proTxHash ,
@@ -1328,7 +1360,11 @@ def update_registrar(self, node: TestNode, submit: bool, pubKeyOperator: Optiona
13281360 elif submit is not True :
13291361 raise AssertionError ("Cannot withhold transaction if relying on fundsAddr fallback behavior" )
13301362
1331- return node .protx (command , * args )
1363+ ret : str = node .protx (command , * args )
1364+ if use_srt :
1365+ ret = node .sendrawtransaction (ret )
1366+
1367+ return ret
13321368
13331369 def update_service (self , node : TestNode , submit : bool , ipAndPort : Optional [str ] = None , platform_node_id : Optional [str ] = None , platform_p2p_port : Optional [int ] = None ,
13341370 platform_http_port : Optional [int ] = None , address_operator : Optional [str ] = None , fundsAddr : Optional [str ] = None ) -> str :
@@ -1347,6 +1383,11 @@ def update_service(self, node: TestNode, submit: bool, ipAndPort: Optional[str]
13471383 if platform_http_port is None :
13481384 raise AssertionError ("EvoNode but platform_http_port is missing, must be specified!" )
13491385
1386+ # Flip a coin and decide if we will submit the transaction directly or use sendrawtransaction
1387+ use_srt : bool = bool (random .getrandbits (1 )) and submit
1388+ if use_srt :
1389+ submit = False
1390+
13501391 # Common arguments shared between regular masternodes and EvoNodes
13511392 args = [
13521393 self .proTxHash ,
@@ -1364,7 +1405,11 @@ def update_service(self, node: TestNode, submit: bool, ipAndPort: Optional[str]
13641405 command = "update_service"
13651406 args = args + [address_operator , address_funds , submit ] # type: ignore
13661407
1367- return node .protx (command , * args )
1408+ ret : str = node .protx (command , * args )
1409+ if use_srt :
1410+ ret = node .sendrawtransaction (ret )
1411+
1412+ return ret
13681413
13691414class DashTestFramework (BitcoinTestFramework ):
13701415 def set_test_params (self ):
0 commit comments