You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #6894: refactor: drop mutex and atomic from CMasternodeMetaInfo, access to object directly without shared_ptr
572bafd refactor: rename IsDsqOver to IsMixingThresholdExceeded (Konstantin Akimov)
16915ff fixup: lock annotation for CMasternodeMetaMan::nDsqCount (Konstantin Akimov)
982b68e fix: usage of ResetPlatformBan in CDeterministicMNList (Konstantin Akimov)
f860031 refactoring: apply code review suggestions (Konstantin Akimov)
fe3966d fix: removed leftover annotation, as follow-up conflict resolving with #6880 (Konstantin Akimov)
969b841 refactor: drop return bool from AddGovernanceVote which is always true (Konstantin Akimov)
04ab976 refactor: remove unused CConnMan from meta.h (Konstantin Akimov)
ed27d90 refactor: use GetMetaInfoOrDefault widely, final (Konstantin Akimov)
b79dd90 refactor: use a helper GetMetaInfo and GetMetaInfoOrDefault internally (Konstantin Akimov)
69ed5f5 refactor: remove useless helpers of CMasternodeMetaInfo (Konstantin Akimov)
1bfd6ff refactor: drop mutex and atomics from CMasternodeMetaInfo (Konstantin Akimov)
d5e693f refactor: drop shared_ptr from CMasternodeMetaMan and make GetMetaInfo a private member (Konstantin Akimov)
c0e146f refactor: hide direct usages of GetMetaInfo for net_processing (Konstantin Akimov)
b1a03e6 refactor: hide direct usages of GetMetaInfo from net module (Konstantin Akimov)
a40c418 refactor: hide direct calls of GetMetaInfo from llmq/utils (Konstantin Akimov)
7ba51ec refactor: remove direct usages of GetMetaInfo for dkgsession (Konstantin Akimov)
7ec239b refactor: replace direct usages of GetMetaInfo when platform unban node in mn-list (Konstantin Akimov)
16abbed refactor: replace direct usages of GetMetaInfo while calculating dsq threshold (Konstantin Akimov)
6cb2344 refactor: replace direct call of MetaInfo from rpc/evo code to helper (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Current implementation:
1. every access to `CMasternodeMetaInfo` is done by accessing `GetMetaInfo` under mutex `CMasternodeMetaMan::cs`
2. `GetMetaInfo` returns shared_ptr to object
3. every read or write of `GetMetaInfo` is protected by atomic, second mutex `CMasternodeMetaInfo::cs`; access to object is done indirectly by one more memory hop (because shared_ptr)
It is not efficient, because `GetMetaInfo` is spread all over code base and not a single case need shared_ptr here; all accesses are brief and short (single read or single write; except RPC where all structure is serialized).
## What was done?
This PR is follow-up for PR #6868 with further improvements and simplification of code.
Instead returning shared_ptr with `CMasternodeMetaInfo` directly access to members of `CMasternodeMetaMan` under its mutex; all mutexes, atomic and shared_ptr itself are removed from `CMasternodeMetaInfo` accesses.
It simplified implementation significantly, removed big amount of thread-safety annotations.
Performance is probably improved, but improvement is unmeasurable, because `CMasternodeMetaInfo` and `CMasternodeMetaMan` has not been spotted as hot spot in profiler neither hot spot in lock contentions logs.
Also this PR removes duplicated code between coinjoin/client and coinjoin/server by creating a helper in `CMasternodeMetaMan`
## How Has This Been Tested?
Run unit & functional tests
## Breaking Changes
N/A
## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
UdjinM6:
utACK 572bafd
Tree-SHA512: a9a955a6d2d5d9c18f35bd900a4d2064217974c44277572cdaf10d729cafa4e937b4fc361d64a5132439227fcc7fd3fff98358e20aa7adcbfbbe2a399f9e5052
0 commit comments