miner: replace "package" with "chunk"
What changed, and why it matters
This commit is a simple renaming of internal function names and variables in Bitcoin Core's block-building code. It changes words like 'package' to 'chunk' to match terminology used elsewhere in the project. No behavior changes, no security fixes, and no bug fixes are visible in the code.
No security action needed. Treat as normal code maintenance/refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames BlockAssembler methods TestPackage -> TestChunkBlockLimits and TestPackageTransactions -> TestChunkTransactions, along with associated parameter and variable names. It also updates comments. The logic, comparisons, and thresholds remain identical. This is a refactoring/cleanup change as part of the cluster mempool implementation.
Changed components
src/node/miner.cppsrc/node/miner.hInspect captured patch +13 / −14
diff --git a/src/node/miner.cpp b/src/node/miner.cpp
index d11bd5c5..8ea538e7 100644
--- a/src/node/miner.cpp
+++ b/src/node/miner.cpp
@@ -193,12 +193,12 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
return std::move(pblocktemplate);
}
-bool BlockAssembler::TestPackage(FeePerWeight package_feerate, int64_t packageSigOpsCost) const
+bool BlockAssembler::TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const
{
- if (nBlockWeight + package_feerate.size >= m_options.nBlockMaxWeight) {
+ if (nBlockWeight + chunk_feerate.size >= m_options.nBlockMaxWeight) {
return false;
}
- if (nBlockSigOpsCost + packageSigOpsCost >= MAX_BLOCK_SIGOPS_COST) {
+ if (nBlockSigOpsCost + chunk_sigops_cost >= MAX_BLOCK_SIGOPS_COST) {
return false;
}
return true;
@@ -206,7 +206,7 @@ bool BlockAssembler::TestPackage(FeePerWeight package_feerate, int64_t packageSi
// Perform transaction-level checks before adding to block:
// - transaction finality (locktime)
-bool BlockAssembler::TestPackageTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const
+bool BlockAssembler::TestChunkTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const
{
for (const auto tx : txs) {
if (!IsFinalTx(tx.get().GetTx(), nHeight, m_lock_time_cutoff)) {
@@ -257,13 +257,13 @@ void BlockAssembler::addChunks()
return;
}
- int64_t package_sig_ops = 0;
+ int64_t chunk_sig_ops = 0;
for (const auto& tx : selected_transactions) {
- package_sig_ops += tx.get().GetSigOpCost();
+ chunk_sig_ops += tx.get().GetSigOpCost();
}
// Check to see if this chunk will fit.
- if (!TestPackage(chunk_feerate, package_sig_ops) || !TestPackageTransactions(selected_transactions)) {
+ if (!TestChunkBlockLimits(chunk_feerate, chunk_sig_ops) || !TestChunkTransactions(selected_transactions)) {
// This chunk won't fit, so we skip it and will try the next best one.
m_mempool->SkipBuilderChunk();
++nConsecutiveFailed;
diff --git a/src/node/miner.h b/src/node/miner.h
index 367c123c..02272242 100644
--- a/src/node/miner.h
+++ b/src/node/miner.h
@@ -110,13 +110,12 @@ private:
void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
// helper functions for addChunks()
- /** Test if a new package would "fit" in the block */
- bool TestPackage(FeePerWeight package_feerate, int64_t packageSigOpsCost) const;
- /** Perform checks on each transaction in a package:
- * locktime, premature-witness, serialized size (if necessary)
- * These checks should always succeed, and they're here
- * only as an extra check in case of suboptimal node configuration */
- bool TestPackageTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const;
+ /** Test if a new chunk would "fit" in the block */
+ bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const;
+ /** Perform locktime checks on each transaction in a chunk:
+ * This check should always succeed, and is here
+ * only as an extra check in case of a bug */
+ bool TestChunkTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const;
};
/**
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.