-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: drop mutex and atomic from CMasternodeMetaInfo, access to object directly without shared_ptr #6894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 15 commits
6cb2344
16abbed
7ec239b
7ba51ec
a40c418
b1a03e6
c0e146f
d5e693f
1bfd6ff
69ed5f5
b79dd90
ed27d90
04ab976
969b841
fe3966d
f860031
982b68e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -676,8 +676,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, gsl::not_null<co | |
| const auto opt_proTx = GetTxPayload<CProUpServTx>(tx); | ||
| if (!opt_proTx) continue; // should not happen but does not matter | ||
|
|
||
| if (auto meta_info = m_mn_metaman.GetMetaInfo(opt_proTx->proTxHash, false); | ||
| !meta_info || !meta_info->SetPlatformBan(false, nHeight)) { | ||
| if (m_mn_metaman.ResetPlatformBan(opt_proTx->proTxHash, nHeight)) { | ||
| LogPrint(BCLog::LLMQ, "%s -- MN %s is failed to Platform revived at height %d\n", __func__, | ||
| opt_proTx->proTxHash.ToString(), nHeight); | ||
| } | ||
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ MessageProcessingResult CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_s | |
| } | ||
|
|
||
| if (!peer.IsInboundConn()) { | ||
| mn_metaman.GetMetaInfo(mnauth.proRegTxHash)->SetLastOutboundSuccess(GetTime<std::chrono::seconds>().count()); | ||
| mn_metaman.SetLastOutboundSuccess(mnauth.proRegTxHash, GetTime<std::chrono::seconds>().count()); | ||
| if (peer.m_masternode_probe_connection) { | ||
| LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- Masternode probe successful for %s, disconnecting. peer=%d\n", | ||
|
Comment on lines
105
to
108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard SetLastOutboundSuccess with mn meta lock
🤖 Prompt for AI Agents |
||
| mnauth.proRegTxHash.ToString(), peer.GetId()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,13 @@ | |||||||||
|
|
||||||||||
| const std::string MasternodeMetaStore::SERIALIZATION_VERSION_STRING = "CMasternodeMetaMan-Version-5"; | ||||||||||
|
|
||||||||||
| static constexpr int MASTERNODE_MAX_FAILED_OUTBOUND_ATTEMPTS{5}; | ||||||||||
| static constexpr int MASTERNODE_MAX_MIXING_TXES{5}; | ||||||||||
|
|
||||||||||
| namespace { | ||||||||||
| static const CMasternodeMetaInfo default_meta_info_meta_info{}; | ||||||||||
|
||||||||||
| static const CMasternodeMetaInfo default_meta_info_meta_info{}; | |
| static const CMasternodeMetaInfo default_meta_info{}; |
?
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also drop nDsqCount++; above, do
| mm.m_last_dsq = nDsqCount.load(); | |
| mm.m_last_dsq = ++nDsqCount; |
and make it pure int64_t nDsqCount GUARDED_BY(cs) {0}; since it's protected by cs everywhere else anyway now
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for (auto& p : metaInfos) { | |
| p.second.RemoveGovernanceObject(nGovernanceObjectHash); | |
| for (auto& [_, meta_info] : metaInfos) { | |
| meta_info.RemoveGovernanceObject(nGovernanceObjectHash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed