@@ -1295,13 +1295,14 @@ static std::optional<ProTx> GetValidatedPayload(const CTransaction& tx, gsl::not
12951295/* *
12961296 * Validates potential changes to masternode state version by ProTx transaction version
12971297 * @param[in] pindexPrev Previous block index to validate DEPLOYMENT_V23 activation
1298+ * @param[in] tx_type Special transaction type
12981299 * @param[in] state_version Current masternode state version
12991300 * @param[in] tx_version Proposed transaction version
13001301 * @param[out] state This may be set to an Error state if any error occurred processing them
13011302 * @returns true if version change is valid or DEPLOYMENT_V23 is not active
13021303 */
1303- bool IsVersionChangeValid (gsl::not_null<const CBlockIndex*> pindexPrev, const uint16_t state_version, const uint16_t tx_version ,
1304- TxValidationState& state)
1304+ bool IsVersionChangeValid (gsl::not_null<const CBlockIndex*> pindexPrev, const uint16_t tx_type ,
1305+ const uint16_t state_version, const uint16_t tx_version, TxValidationState& state)
13051306{
13061307 if (!DeploymentActiveAfter (pindexPrev, Params ().GetConsensus (), Consensus::DEPLOYMENT_V23)) {
13071308 // New restrictions only apply after v23 deployment
@@ -1318,6 +1319,11 @@ bool IsVersionChangeValid(gsl::not_null<const CBlockIndex*> pindexPrev, const ui
13181319 return state.Invalid (TxValidationResult::TX_CONSENSUS, " bad-protx-version-upgrade" );
13191320 }
13201321
1322+ if (tx_type != TRANSACTION_PROVIDER_UPDATE_SERVICE && tx_version == ProTxVersion::ExtAddr) {
1323+ // Only new entries (ProRegTx) and service updates (ProUpServTx) can use ExtAddr versioning
1324+ return state.Invalid (TxValidationResult::TX_CONSENSUS, " bad-protx-version-tx-type" );
1325+ }
1326+
13211327 return true ;
13221328}
13231329
@@ -1468,7 +1474,7 @@ bool CheckProUpServTx(CDeterministicMNManager& dmnman, const CTransaction& tx, g
14681474 return state.Invalid (TxValidationResult::TX_CONSENSUS, " bad-protx-hash" );
14691475 }
14701476
1471- if (!IsVersionChangeValid (pindexPrev, dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
1477+ if (!IsVersionChangeValid (pindexPrev, tx. nType , dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
14721478 // pass the state returned by the function above
14731479 return false ;
14741480 }
@@ -1535,7 +1541,7 @@ bool CheckProUpRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gs
15351541 return state.Invalid (TxValidationResult::TX_CONSENSUS, " bad-protx-hash" );
15361542 }
15371543
1538- if (!IsVersionChangeValid (pindexPrev, dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
1544+ if (!IsVersionChangeValid (pindexPrev, tx. nType , dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
15391545 // pass the state returned by the function above
15401546 return false ;
15411547 }
@@ -1599,7 +1605,7 @@ bool CheckProUpRevTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gs
15991605 return state.Invalid (TxValidationResult::TX_CONSENSUS, " bad-protx-hash" );
16001606 }
16011607
1602- if (!IsVersionChangeValid (pindexPrev, dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
1608+ if (!IsVersionChangeValid (pindexPrev, tx. nType , dmn->pdmnState ->nVersion , opt_ptx->nVersion , state)) {
16031609 // pass the state returned by the function above
16041610 return false ;
16051611 }
0 commit comments