@@ -470,7 +470,7 @@ void CDeterministicMNList::AddMN(const CDeterministicMNCPtr& dmn, bool fBumpTota
470470 throw (std::runtime_error (strprintf (" %s: Can't add a masternode %s with a duplicate collateralOutpoint=%s" , __func__,
471471 dmn->proTxHash .ToString (), dmn->collateralOutpoint .ToStringShort ())));
472472 }
473- for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo . GetEntries ()) {
473+ for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo -> GetEntries ()) {
474474 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
475475 const CService& service{service_opt.value ()};
476476 if (!AddUniqueProperty (*dmn, service)) {
@@ -524,7 +524,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::s
524524 // We track each individual entry in netInfo as opposed to netInfo itself (preventing us from
525525 // using UpdateUniqueProperty()), so we need to successfully purge all old entries and insert
526526 // new entries to successfully update.
527- for (const NetInfoEntry& old_entry : oldState->netInfo . GetEntries ()) {
527+ for (const NetInfoEntry& old_entry : oldState->netInfo -> GetEntries ()) {
528528 if (const auto & service_opt{old_entry.GetAddrPort ()}; service_opt.has_value ()) {
529529 const CService& service{service_opt.value ()};
530530 if (!DeleteUniqueProperty (*dmn, service)) {
@@ -534,7 +534,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::s
534534 return strprintf (" invalid address" );
535535 }
536536 }
537- for (const NetInfoEntry& new_entry : pdmnState->netInfo . GetEntries ()) {
537+ for (const NetInfoEntry& new_entry : pdmnState->netInfo -> GetEntries ()) {
538538 if (const auto & service_opt{new_entry.GetAddrPort ()}; service_opt.has_value ()) {
539539 const CService& service{service_opt.value ()};
540540 if (!AddUniqueProperty (*dmn, service)) {
@@ -607,7 +607,7 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash)
607607 throw (std::runtime_error (strprintf (" %s: Can't delete a masternode %s with a collateralOutpoint=%s" , __func__,
608608 proTxHash.ToString (), dmn->collateralOutpoint .ToStringShort ())));
609609 }
610- for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo . GetEntries ()) {
610+ for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo -> GetEntries ()) {
611611 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
612612 const CService& service{service_opt.value ()};
613613 if (!DeleteUniqueProperty (*dmn, service)) {
@@ -833,7 +833,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
833833 }
834834 }
835835
836- for (const NetInfoEntry& entry : proTx.netInfo . GetEntries ()) {
836+ for (const NetInfoEntry& entry : proTx.netInfo -> GetEntries ()) {
837837 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
838838 const CService& service{service_opt.value ()};
839839 if (newList.HasUniqueProperty (service)) {
@@ -851,7 +851,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
851851
852852 auto dmnState = std::make_shared<CDeterministicMNState>(proTx);
853853 dmnState->nRegisteredHeight = nHeight;
854- if (proTx.netInfo . IsEmpty ()) {
854+ if (proTx.netInfo -> IsEmpty ()) {
855855 // start in banned pdmnState as we need to wait for a ProUpServTx
856856 dmnState->BanIfNotBanned (nHeight);
857857 }
@@ -869,7 +869,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
869869 return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-protx-payload" );
870870 }
871871
872- for (const NetInfoEntry& entry : opt_proTx->netInfo . GetEntries ()) {
872+ for (const NetInfoEntry& entry : opt_proTx->netInfo -> GetEntries ()) {
873873 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
874874 const CService& service{service_opt.value ()};
875875 if (newList.HasUniqueProperty (service) &&
@@ -934,6 +934,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
934934 newState->BanIfNotBanned (nHeight);
935935 // we update pubKeyOperator here, make sure state version matches
936936 newState->nVersion = opt_proTx->nVersion ;
937+ newState->netInfo = MakeNetInfo (*newState);
937938 newState->pubKeyOperator = opt_proTx->pubKeyOperator ;
938939 }
939940 newState->keyIDVoting = opt_proTx->keyIDVoting ;
@@ -1236,7 +1237,7 @@ void CDeterministicMNManager::CleanupCache(int nHeight)
12361237template <typename ProTx>
12371238static bool CheckService (const ProTx& proTx, TxValidationState& state)
12381239{
1239- switch (proTx.netInfo . Validate ()) {
1240+ switch (proTx.netInfo -> Validate ()) {
12401241 case NetInfoStatus::BadAddress:
12411242 return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-netinfo-addr" );
12421243 case NetInfoStatus::BadInput:
@@ -1287,8 +1288,8 @@ static bool CheckPlatformFields(const ProTx& proTx, TxValidationState& state)
12871288 return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-platform-http-port" );
12881289 }
12891290
1290- if (proTx.platformP2PPort == proTx.platformHTTPPort || proTx.platformP2PPort == proTx.netInfo . GetPrimary ().GetPort () ||
1291- proTx.platformHTTPPort == proTx.netInfo . GetPrimary ().GetPort ()) {
1291+ if (proTx.platformP2PPort == proTx.platformHTTPPort || proTx.platformP2PPort == proTx.netInfo -> GetPrimary ().GetPort () ||
1292+ proTx.platformHTTPPort == proTx.netInfo -> GetPrimary ().GetPort ()) {
12921293 return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-platform-dup-ports" );
12931294 }
12941295
@@ -1353,7 +1354,7 @@ bool CheckProRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gsl:
13531354
13541355 // It's allowed to set addr to 0, which will put the MN into PoSe-banned state and require a ProUpServTx to be issues later
13551356 // If any of both is set, it must be valid however
1356- if (!opt_ptx->netInfo . IsEmpty () && !CheckService (*opt_ptx, state)) {
1357+ if (!opt_ptx->netInfo -> IsEmpty () && !CheckService (*opt_ptx, state)) {
13571358 // pass the state returned by the function above
13581359 return false ;
13591360 }
@@ -1413,7 +1414,7 @@ bool CheckProRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gsl:
14131414 auto mnList = dmnman.GetListForBlock (pindexPrev);
14141415
14151416 // only allow reusing of addresses when it's for the same collateral (which replaces the old MN)
1416- for (const NetInfoEntry& entry : opt_ptx->netInfo . GetEntries ()) {
1417+ for (const NetInfoEntry& entry : opt_ptx->netInfo -> GetEntries ()) {
14171418 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
14181419 const CService& service{service_opt.value ()};
14191420 if (mnList.HasUniqueProperty (service) &&
@@ -1491,7 +1492,7 @@ bool CheckProUpServTx(CDeterministicMNManager& dmnman, const CTransaction& tx, g
14911492 }
14921493
14931494 // don't allow updating to addresses already used by other MNs
1494- for (const NetInfoEntry& entry : opt_ptx->netInfo . GetEntries ()) {
1495+ for (const NetInfoEntry& entry : opt_ptx->netInfo -> GetEntries ()) {
14951496 if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
14961497 const CService& service{service_opt.value ()};
14971498 if (mnList.HasUniqueProperty (service) && mnList.GetUniquePropertyMN (service)->proTxHash != opt_ptx->proTxHash ) {
0 commit comments