miner: replace "package" with "chunk"
This makes the terminology consistent with other parts of the codebase, as part of the cluster mempool implementation.
This commit is contained in:
1 parent
6f3e8eb300
commit
2d88966e43
2 files changed
+13
-14
No files matched your search
+7
-7
@@ -193,12 +193,12 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
|
|||||||
return std::move(pblocktemplate);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (nBlockSigOpsCost + packageSigOpsCost >= MAX_BLOCK_SIGOPS_COST) {
|
if (nBlockSigOpsCost + chunk_sigops_cost >= MAX_BLOCK_SIGOPS_COST) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -206,7 +206,7 @@ bool BlockAssembler::TestPackage(FeePerWeight package_feerate, int64_t packageSi
|
|||||||
|
|
||||||
// Perform transaction-level checks before adding to block:
|
// Perform transaction-level checks before adding to block:
|
||||||
// - transaction finality (locktime)
|
// - 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) {
|
for (const auto tx : txs) {
|
||||||
if (!IsFinalTx(tx.get().GetTx(), nHeight, m_lock_time_cutoff)) {
|
if (!IsFinalTx(tx.get().GetTx(), nHeight, m_lock_time_cutoff)) {
|
||||||
@@ -257,13 +257,13 @@ void BlockAssembler::addChunks()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t package_sig_ops = 0;
|
int64_t chunk_sig_ops = 0;
|
||||||
for (const auto& tx : selected_transactions) {
|
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.
|
// 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.
|
// This chunk won't fit, so we skip it and will try the next best one.
|
||||||
m_mempool->SkipBuilderChunk();
|
m_mempool->SkipBuilderChunk();
|
||||||
++nConsecutiveFailed;
|
++nConsecutiveFailed;
|
||||||
|
|||||||
+6
-7
@@ -110,13 +110,12 @@ private:
|
|||||||
void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
|
void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
|
||||||
|
|
||||||
// helper functions for addChunks()
|
// helper functions for addChunks()
|
||||||
/** Test if a new package would "fit" in the block */
|
/** Test if a new chunk would "fit" in the block */
|
||||||
bool TestPackage(FeePerWeight package_feerate, int64_t packageSigOpsCost) const;
|
bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const;
|
||||||
/** Perform checks on each transaction in a package:
|
/** Perform locktime checks on each transaction in a chunk:
|
||||||
* locktime, premature-witness, serialized size (if necessary)
|
* This check should always succeed, and is here
|
||||||
* These checks should always succeed, and they're here
|
* only as an extra check in case of a bug */
|
||||||
* only as an extra check in case of suboptimal node configuration */
|
bool TestChunkTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const;
|
||||||
bool TestPackageTransactions(const std::vector<CTxMemPoolEntryRef>& txs) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user