-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: remove dependencies of CChainState on CMasternodeSync #7212
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 all commits
91824b7
6b2f318
cabf5e4
c06dd4f
d81e9f9
57fb6ee
94eeabd
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,11 @@ | |||||||||
| #include <util/time.h> | ||||||||||
| #include <util/translation.h> | ||||||||||
|
|
||||||||||
| #include <cassert> | ||||||||||
|
|
||||||||||
| void NullNodeSyncNotifier::SyncReset() { assert(false); } | ||||||||||
| void NullNodeSyncNotifier::SyncFinished() { assert(false); } | ||||||||||
|
knst marked this conversation as resolved.
Comment on lines
+14
to
+15
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. 🟡 Suggestion: NullNodeSyncNotifier uses lowercase assert(false) — compiled out under NDEBUG The header at src/masternode/sync.h:35-41 documents that NullNodeSyncNotifier 'asserts on any call — if sync state is being advanced, a real notifier (NodeSyncNotifierImpl) must be used instead.' The implementation uses the C 💡 Suggested change
Suggested change
source: ['claude'] 🤖 Fix this with AI agents |
||||||||||
|
|
||||||||||
| CMasternodeSync::CMasternodeSync(std::unique_ptr<NodeSyncNotifier>&& sync_notifier) : | ||||||||||
| nTimeAssetSyncStarted{GetTime()}, | ||||||||||
| nTimeLastBumped{GetTime()}, | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,6 +32,20 @@ class NodeSyncNotifier | |||||||||||||||||||||||||||||
| virtual ~NodeSyncNotifier() = default; | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /** Stub implementation for use in chainstate-only (non-network) contexts. | ||||||||||||||||||||||||||||||
| * CMasternodeSync constructed with this notifier permanently returns | ||||||||||||||||||||||||||||||
| * IsBlockchainSynced()=false and IsSynced()=false, which correctly disables | ||||||||||||||||||||||||||||||
| * network-dependent validation paths. | ||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||
| * Asserts on any call — if sync state is being advanced, a real notifier | ||||||||||||||||||||||||||||||
| * (NodeSyncNotifierImpl) must be used instead. */ | ||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+41
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. Doc comment overstates the notifier guarantee Line 36–38 says this setup permanently keeps Suggested wording tweak-/** Stub implementation for use in chainstate-only (non-network) contexts.
- * CMasternodeSync constructed with this notifier permanently returns
- * IsBlockchainSynced()=false and IsSynced()=false, which correctly disables
- * network-dependent validation paths.
+/** Stub implementation for use in chainstate-only (non-network) contexts.
+ * In expected chainstate-only usage, sync state is not advanced, so
+ * IsBlockchainSynced() and IsSynced() remain false, disabling
+ * network-dependent validation paths.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| class NullNodeSyncNotifier final : public NodeSyncNotifier | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| public: | ||||||||||||||||||||||||||||||
| void SyncReset() override; | ||||||||||||||||||||||||||||||
| void SyncFinished() override; | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||
| // CMasternodeSync : Sync masternode assets in stages | ||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
50
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. 💬 Nitpick: The commit message for 94eeabd says the stub is introduced 'to use it for CChainState', but a grep across source: ['claude'] |
||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
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.
This branch now depends on
m_govman.IsValidAndSynced(), but the previous logic only required masternode sync; as a result, when governance is disabled (e.g.-disablegovernance) or governance state is unavailable, a fully synced node takes the "accepting block" path and skips theblockRewardcap for old-budget-window heights. That can allow overpaying coinbase amounts to be accepted betweennBudgetPaymentsStartBlockandnSuperblockStartBlock, creating validation differences versus nodes that still enforce the cap.Useful? React with 👍 / 👎.