Commit e4fa575
committed
Merge #6875: feat: share
eb3be09 refactor: code style/log text adjustments (UdjinM6)
f50d09a fix: update `MasternodeMetaStore::ToString()` (UdjinM6)
13a28fa perf: optimize CoinJoin masternode tracking with hybrid data structure (UdjinM6)
2c82532 feat: share `vecMasternodesUsed` across all wallets, improve its handling (UdjinM6)
Pull request description:
## Issue being fixed or feature implemented
`vecMasternodesUsed` has a few issues:
- it's shared only across mixing sessions in a single wallet, wallets don't share this data so it's possible they are going to waste tries in `StartNewQueue()` and fail to start mixing because of that
- we start with a fresh vector each time which also can result in failed mixing attempts
- there are two threads (scheduler and net) where it can be accessed but it's not protected by any mutex atm
- it still stores masternode outpoints while most of our codebase uses protxhash-es as masternode ids
## What was done?
- moved it to `MasternodeMetaStore` and renamed it to `m_used_masternodes`
- changed to `std::vector<uint256>` (using `proTxHash` now)
- implemented proper encapsulation through accessor methods
- `m_used_masternodes` is no longer accessed via multiple threads (because it's not cleared in `ResetPool()`) but I made it thread-safe anyway just in case (using existing `Mutex cs`)
- made it persistent via serialization (with version bump 4 -> 5)
## How Has This Been Tested?
Mixing in multiple wallets at once
## Breaking Changes
n/a
## Checklist:
- [ ] 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
- [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
ACKs for top commit:
knst:
utACK eb3be09
kwvg:
utACK eb3be09
Tree-SHA512: 68527f4edb255baf879055d622d72e3aff9807ee37c59dca3b7f4436df8bba67fddba9331b5d8af50ca849fdcfbb57ef003bf093856fc1ba210d43deecd8048cvecMasternodesUsed across all wallets, improve its handling4 files changed
+77
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
| |||
967 | 966 | | |
968 | 967 | | |
969 | 968 | | |
970 | | - | |
| 969 | + | |
971 | 970 | | |
972 | | - | |
973 | | - | |
974 | | - | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
975 | 977 | | |
976 | 978 | | |
977 | 979 | | |
| |||
995 | 997 | | |
996 | 998 | | |
997 | 999 | | |
998 | | - | |
| 1000 | + | |
999 | 1001 | | |
1000 | | - | |
| 1002 | + | |
1001 | 1003 | | |
1002 | 1004 | | |
1003 | 1005 | | |
1004 | 1006 | | |
1005 | 1007 | | |
1006 | 1008 | | |
1007 | 1009 | | |
1008 | | - | |
| 1010 | + | |
1009 | 1011 | | |
1010 | 1012 | | |
1011 | 1013 | | |
| |||
1022 | 1024 | | |
1023 | 1025 | | |
1024 | 1026 | | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
| 1027 | + | |
1028 | 1028 | | |
1029 | | - | |
| 1029 | + | |
1030 | 1030 | | |
1031 | 1031 | | |
1032 | 1032 | | |
1033 | | - | |
| 1033 | + | |
| 1034 | + | |
1034 | 1035 | | |
1035 | 1036 | | |
1036 | 1037 | | |
| |||
1083 | 1084 | | |
1084 | 1085 | | |
1085 | 1086 | | |
1086 | | - | |
| 1087 | + | |
1087 | 1088 | | |
1088 | 1089 | | |
1089 | 1090 | | |
| |||
1137 | 1138 | | |
1138 | 1139 | | |
1139 | 1140 | | |
1140 | | - | |
| 1141 | + | |
1141 | 1142 | | |
1142 | 1143 | | |
1143 | 1144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 265 | | |
269 | 266 | | |
270 | 267 | | |
| |||
327 | 324 | | |
328 | 325 | | |
329 | 326 | | |
330 | | - | |
| 327 | + | |
331 | 328 | | |
332 | 329 | | |
333 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
156 | 189 | | |
157 | 190 | | |
158 | 191 | | |
159 | | - | |
| 192 | + | |
| 193 | + | |
160 | 194 | | |
161 | 195 | | |
162 | 196 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
| |||
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
152 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
167 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
168 | 177 | | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
172 | 186 | | |
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
176 | 190 | | |
177 | 191 | | |
178 | 192 | | |
| 193 | + | |
| 194 | + | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
| |||
257 | 273 | | |
258 | 274 | | |
259 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
260 | 282 | | |
261 | 283 | | |
262 | 284 | | |
0 commit comments