Commit f45e47d
committed
Merge #6959: refactor: separate network and consensus logic 1/N [instantsend]
d4d64f6 fix: don't remove handlers too early (Konstantin Akimov)
a26a974 perf: std::move a shared_ptr with islock in ProcessMessage (Konstantin Akimov)
3c26523 fix: update log records from CInstantSendManager for NetInstantSend instead and tidy up them a bit (Konstantin Akimov)
90d7879 refactor: use NetHandler class to separate instantsend logic and network logic (Konstantin Akimov)
466e2a2 feat: introduce new bridge interface NetHandler to separate network logic and consensus (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Separation of consensus & chain code and network & node in Dash Core is blocked by tight connection of network and consensus code; in components such as `llmq::CSigningManager`, `llmq::CSigSharesManager`, `coinjoin::client`, `coinjoin::server`, `governance/`, `llmq::CInstantSendManager`, etc.
It blocks backport's of bitcoin related to 'kernel' project.
This PR addresses 1st dependency of `llmq::CInstantSendManager` on `PeerManager`.
It is a split from proof-of-concept PR #6934
## What was done?
This PR introduces `NetHandler` which is a bridge interface between node/network related code and between consensus/chain code. In case if there is no need any network, objects that inherited by `NetHandler` are not created.
```
class NetHandler
{
public:
NetHandler(PeerManagerInternal* peer_manager) : m_peer_manager{Assert(peer_manager)} {}
virtual ~NetHandler() {
Interrupt();
Stop();
}
virtual void Start() {}
virtual void Stop() {}
virtual void Interrupt() {}
virtual void Schedule(CScheduler& scheduler, CConnman& connman) {}
virtual void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) {}
protected:
PeerManagerInternal* m_peer_manager;
};
```
## How Has This Been Tested?
Run unit & functional tests.
Run a linter `test/lint/lint-circular-dependencies.py`
Overall conception is tested in #6934 as potentially successful to finish separation of network & consensus code.
## Breaking Changes
N/A
## Checklist:
- [x] I have performed a self-review of my own code
- [x] 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
Top commit has no ACKs.
Tree-SHA512: 5bf0a00f3b10b84019be5b70aa3e4baddd2c7735d4f177a6391ef362d34e62996438ae1ccbc106ea9966b539206b1694e9542a33cf9aca96f681f829f707b2ccFile tree
11 files changed
+545
-379
lines changed- src
- instantsend
- llmq
- test/lint
11 files changed
+545
-379
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| |||
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
| 527 | + | |
526 | 528 | | |
527 | 529 | | |
528 | 530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| |||
285 | 289 | | |
286 | 290 | | |
287 | 291 | | |
| 292 | + | |
288 | 293 | | |
| 294 | + | |
289 | 295 | | |
290 | 296 | | |
291 | 297 | | |
| |||
2193 | 2199 | | |
2194 | 2200 | | |
2195 | 2201 | | |
| 2202 | + | |
2196 | 2203 | | |
2197 | 2204 | | |
2198 | 2205 | | |
| |||
2288 | 2295 | | |
2289 | 2296 | | |
2290 | 2297 | | |
| 2298 | + | |
2291 | 2299 | | |
2292 | 2300 | | |
2293 | 2301 | | |
| |||
0 commit comments