-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: bitcoin#23508, #24187, #24528, #24579, #25412, #27853 (deployment backports) #6888
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
f6c2322
3bed34d
5b18dd0
2d0a51e
deedb50
4832db2
e5688b2
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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Updated RPCs | ||
| ------------ | ||
|
|
||
| - Information on soft fork status has been moved from `getblockchaininfo` | ||
| to the new `getdeploymentinfo` RPC which allows querying soft fork status at any | ||
| block, rather than just at the chain tip. Inclusion of soft fork | ||
| status in `getblockchaininfo` can currently be restored using the | ||
| configuration `-deprecatedrpc=softforks`, but this will be removed in | ||
| a future release. Note that in either case, the `status` field | ||
| now reflects the status of the current block rather than the next | ||
| block (#6888). | ||
|
|
||
| New REST endpoint | ||
| ----------------- | ||
|
|
||
| - A new `/rest/deploymentinfo` endpoint has been added for fetching various | ||
| state info regarding deployments of consensus changes (#6888). |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,21 +137,25 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* | |
| return state; | ||
| } | ||
|
|
||
| BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params, ThresholdConditionCache& cache) const | ||
| BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params, ThresholdConditionCache& cache, std::vector<bool>* signalling_blocks) const | ||
| { | ||
| BIP9Stats stats = {}; | ||
|
|
||
| stats.period = Period(params); | ||
| stats.threshold = Threshold(params, 0); | ||
|
|
||
| if (pindex == nullptr) | ||
| return stats; | ||
| if (pindex == nullptr) return stats; | ||
|
|
||
| // Find beginning of period | ||
| const CBlockIndex* pindexEndOfPrevPeriod = pindex->GetAncestor(pindex->nHeight - ((pindex->nHeight + 1) % stats.period)); | ||
| stats.elapsed = pindex->nHeight - pindexEndOfPrevPeriod->nHeight; | ||
| // Find how many blocks are in the current period | ||
| int blocks_in_period = 1 + (pindex->nHeight % stats.period); | ||
|
|
||
| // Reset signalling_blocks | ||
| if (signalling_blocks) { | ||
| signalling_blocks->assign(blocks_in_period, false); | ||
| } | ||
|
|
||
| // Re-calculate current threshold | ||
| const CBlockIndex* pindexEndOfPrevPeriod = pindex->GetAncestor(pindex->nHeight - ((pindex->nHeight + 1) % stats.period)); | ||
| int nAttempt{0}; | ||
| const ThresholdState state = GetStateFor(pindexEndOfPrevPeriod, params, cache); | ||
| if (state == ThresholdState::STARTED) { | ||
|
|
@@ -161,14 +165,20 @@ BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockI | |
| stats.threshold = Threshold(params, nAttempt); | ||
|
|
||
| // Count from current block to beginning of period | ||
| int elapsed = 0; | ||
| int count = 0; | ||
| const CBlockIndex* currentIndex = pindex; | ||
| while (pindexEndOfPrevPeriod->nHeight != currentIndex->nHeight){ | ||
| if (Condition(currentIndex, params)) | ||
| count++; | ||
| do { | ||
| ++elapsed; | ||
| --blocks_in_period; | ||
| if (Condition(currentIndex, params)) { | ||
| ++count; | ||
| if (signalling_blocks) signalling_blocks->at(blocks_in_period) = true; | ||
| } | ||
| currentIndex = currentIndex->pprev; | ||
| } | ||
| } while (blocks_in_period > 0); | ||
|
Collaborator
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. nit: remove extra space |
||
|
|
||
| stats.elapsed = elapsed; | ||
| stats.count = count; | ||
| stats.possible = (stats.period - stats.threshold ) >= (stats.elapsed - count); | ||
|
|
||
|
|
@@ -269,10 +279,10 @@ ThresholdState VersionBitsCache::State(const CBlockIndex* pindexPrev, const Cons | |
| return VersionBitsConditionChecker(pos).GetStateFor(pindexPrev, params, m_caches[pos]); | ||
| } | ||
|
|
||
| BIP9Stats VersionBitsCache::Statistics(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos) | ||
| BIP9Stats VersionBitsCache::Statistics(const CBlockIndex* pindex, const Consensus::Params& params, Consensus::DeploymentPos pos, std::vector<bool>* signalling_blocks) | ||
| { | ||
| LOCK(m_mutex); | ||
| return VersionBitsConditionChecker(pos).GetStateStatisticsFor(pindexPrev, params, m_caches[pos]); | ||
| return VersionBitsConditionChecker(pos).GetStateStatisticsFor(pindex, params, m_caches[pos], signalling_blocks); | ||
| } | ||
|
|
||
| int VersionBitsCache::StateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,18 +165,21 @@ def run_test(self): | |
| self.check_fork('defined') | ||
| self.generate(node, 1) | ||
|
|
||
| self.generate(node, 1) | ||
|
|
||
| for _ in range(4 // 2): | ||
| self.check_fork('started') | ||
| self.generate(node, 2) | ||
|
|
||
| self.generate(node, 1) | ||
|
|
||
| for i in range(4 // 2): | ||
| self.check_fork('locked_in') | ||
| self.generate(node, 2) | ||
| if i == 1: | ||
| self.restart_all_nodes() | ||
|
|
||
| self.generate(node, 1) | ||
| self.check_fork('active') | ||
|
|
||
| fork_active_blockhash = node.getbestblockhash() | ||
|
|
@@ -197,7 +200,7 @@ def run_test(self): | |
| assert tx_sent_2 in node.getblock(ehf_blockhash_2)['tx'] | ||
|
|
||
| self.log.info(f"Generate some more block to jump to `started` status") | ||
| self.generate(node, 4) | ||
| self.generate(node, 5) | ||
|
Comment on lines
168
to
+203
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: Extra Three source: ['claude']
Collaborator
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.
|
||
| self.check_fork('started') | ||
| self.restart_node(0) | ||
| self.check_fork('started') | ||
|
|
||
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.
Fix heading style to satisfy markdownlint MD003.
This new heading currently triggers the configured heading-style rule; please align it with the repository’s markdownlint style to avoid lint noise.
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 89-89: Heading style
Expected: setext; Actual: atx
(MD003, heading-style)
🤖 Prompt for AI Agents