@@ -470,7 +470,7 @@ void CDeterministicMNList::AddMN(const CDeterministicMNCPtr& dmn, bool fBumpTota
470
470
throw (std::runtime_error (strprintf (" %s: Can't add a masternode %s with a duplicate collateralOutpoint=%s" , __func__,
471
471
dmn->proTxHash .ToString (), dmn->collateralOutpoint .ToStringShort ())));
472
472
}
473
- for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo . GetEntries ()) {
473
+ for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo -> GetEntries ()) {
474
474
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
475
475
const CService& service{service_opt.value ()};
476
476
if (!AddUniqueProperty (*dmn, service)) {
@@ -524,7 +524,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::s
524
524
// We track each individual entry in netInfo as opposed to netInfo itself (preventing us from
525
525
// using UpdateUniqueProperty()), so we need to successfully purge all old entries and insert
526
526
// new entries to successfully update.
527
- for (const NetInfoEntry& old_entry : oldState->netInfo . GetEntries ()) {
527
+ for (const NetInfoEntry& old_entry : oldState->netInfo -> GetEntries ()) {
528
528
if (const auto & service_opt{old_entry.GetAddrPort ()}; service_opt.has_value ()) {
529
529
const CService& service{service_opt.value ()};
530
530
if (!DeleteUniqueProperty (*dmn, service)) {
@@ -534,7 +534,7 @@ void CDeterministicMNList::UpdateMN(const CDeterministicMN& oldDmn, const std::s
534
534
return strprintf (" invalid address" );
535
535
}
536
536
}
537
- for (const NetInfoEntry& new_entry : pdmnState->netInfo . GetEntries ()) {
537
+ for (const NetInfoEntry& new_entry : pdmnState->netInfo -> GetEntries ()) {
538
538
if (const auto & service_opt{new_entry.GetAddrPort ()}; service_opt.has_value ()) {
539
539
const CService& service{service_opt.value ()};
540
540
if (!AddUniqueProperty (*dmn, service)) {
@@ -607,7 +607,7 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash)
607
607
throw (std::runtime_error (strprintf (" %s: Can't delete a masternode %s with a collateralOutpoint=%s" , __func__,
608
608
proTxHash.ToString (), dmn->collateralOutpoint .ToStringShort ())));
609
609
}
610
- for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo . GetEntries ()) {
610
+ for (const NetInfoEntry& entry : dmn->pdmnState ->netInfo -> GetEntries ()) {
611
611
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
612
612
const CService& service{service_opt.value ()};
613
613
if (!DeleteUniqueProperty (*dmn, service)) {
@@ -833,7 +833,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
833
833
}
834
834
}
835
835
836
- for (const NetInfoEntry& entry : proTx.netInfo . GetEntries ()) {
836
+ for (const NetInfoEntry& entry : proTx.netInfo -> GetEntries ()) {
837
837
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
838
838
const CService& service{service_opt.value ()};
839
839
if (newList.HasUniqueProperty (service)) {
@@ -851,7 +851,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
851
851
852
852
auto dmnState = std::make_shared<CDeterministicMNState>(proTx);
853
853
dmnState->nRegisteredHeight = nHeight;
854
- if (proTx.netInfo . IsEmpty ()) {
854
+ if (proTx.netInfo -> IsEmpty ()) {
855
855
// start in banned pdmnState as we need to wait for a ProUpServTx
856
856
dmnState->BanIfNotBanned (nHeight);
857
857
}
@@ -869,7 +869,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
869
869
return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-protx-payload" );
870
870
}
871
871
872
- for (const NetInfoEntry& entry : opt_proTx->netInfo . GetEntries ()) {
872
+ for (const NetInfoEntry& entry : opt_proTx->netInfo -> GetEntries ()) {
873
873
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
874
874
const CService& service{service_opt.value ()};
875
875
if (newList.HasUniqueProperty (service) &&
@@ -934,6 +934,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
934
934
newState->BanIfNotBanned (nHeight);
935
935
// we update pubKeyOperator here, make sure state version matches
936
936
newState->nVersion = opt_proTx->nVersion ;
937
+ newState->netInfo = MakeNetInfo (*newState);
937
938
newState->pubKeyOperator = opt_proTx->pubKeyOperator ;
938
939
}
939
940
newState->keyIDVoting = opt_proTx->keyIDVoting ;
@@ -1236,7 +1237,7 @@ void CDeterministicMNManager::CleanupCache(int nHeight)
1236
1237
template <typename ProTx>
1237
1238
static bool CheckService (const ProTx& proTx, TxValidationState& state)
1238
1239
{
1239
- switch (proTx.netInfo . Validate ()) {
1240
+ switch (proTx.netInfo -> Validate ()) {
1240
1241
case NetInfoStatus::BadAddress:
1241
1242
return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-netinfo-addr" );
1242
1243
case NetInfoStatus::BadPort:
@@ -1288,8 +1289,8 @@ static bool CheckPlatformFields(const ProTx& proTx, TxValidationState& state)
1288
1289
return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-platform-http-port" );
1289
1290
}
1290
1291
1291
- if (proTx.platformP2PPort == proTx.platformHTTPPort || proTx.platformP2PPort == proTx.netInfo . GetPrimary ().GetPort () ||
1292
- proTx.platformHTTPPort == proTx.netInfo . GetPrimary ().GetPort ()) {
1292
+ if (proTx.platformP2PPort == proTx.platformHTTPPort || proTx.platformP2PPort == proTx.netInfo -> GetPrimary ().GetPort () ||
1293
+ proTx.platformHTTPPort == proTx.netInfo -> GetPrimary ().GetPort ()) {
1293
1294
return state.Invalid (TxValidationResult::TX_BAD_SPECIAL, " bad-protx-platform-dup-ports" );
1294
1295
}
1295
1296
@@ -1354,7 +1355,7 @@ bool CheckProRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gsl:
1354
1355
1355
1356
// 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
1356
1357
// If any of both is set, it must be valid however
1357
- if (!opt_ptx->netInfo . IsEmpty () && !CheckService (*opt_ptx, state)) {
1358
+ if (!opt_ptx->netInfo -> IsEmpty () && !CheckService (*opt_ptx, state)) {
1358
1359
// pass the state returned by the function above
1359
1360
return false ;
1360
1361
}
@@ -1414,7 +1415,7 @@ bool CheckProRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gsl:
1414
1415
auto mnList = dmnman.GetListForBlock (pindexPrev);
1415
1416
1416
1417
// only allow reusing of addresses when it's for the same collateral (which replaces the old MN)
1417
- for (const NetInfoEntry& entry : opt_ptx->netInfo . GetEntries ()) {
1418
+ for (const NetInfoEntry& entry : opt_ptx->netInfo -> GetEntries ()) {
1418
1419
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
1419
1420
const CService& service{service_opt.value ()};
1420
1421
if (mnList.HasUniqueProperty (service) &&
@@ -1492,7 +1493,7 @@ bool CheckProUpServTx(CDeterministicMNManager& dmnman, const CTransaction& tx, g
1492
1493
}
1493
1494
1494
1495
// don't allow updating to addresses already used by other MNs
1495
- for (const NetInfoEntry& entry : opt_ptx->netInfo . GetEntries ()) {
1496
+ for (const NetInfoEntry& entry : opt_ptx->netInfo -> GetEntries ()) {
1496
1497
if (const auto & service_opt{entry.GetAddrPort ()}; service_opt.has_value ()) {
1497
1498
const CService& service{service_opt.value ()};
1498
1499
if (mnList.HasUniqueProperty (service) && mnList.GetUniquePropertyMN (service)->proTxHash != opt_ptx->proTxHash ) {
0 commit comments