aboutsummaryrefslogtreecommitdiff
path: root/src/miner.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/miner.h')
-rw-r--r--src/miner.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/miner.h b/src/miner.h
index 54c680b5ff..bad443b82a 100644
--- a/src/miner.h
+++ b/src/miner.h
@@ -28,7 +28,8 @@ struct CBlockTemplate
{
CBlock block;
std::vector<CAmount> vTxFees;
- std::vector<int64_t> vTxSigOps;
+ std::vector<int64_t> vTxSigOpsCost;
+ std::vector<unsigned char> vchCoinbaseCommitment;
};
// Container for tracking updates to ancestor feerate as we include (parent)
@@ -39,13 +40,13 @@ struct CTxMemPoolModifiedEntry {
iter = entry;
nSizeWithAncestors = entry->GetSizeWithAncestors();
nModFeesWithAncestors = entry->GetModFeesWithAncestors();
- nSigOpCountWithAncestors = entry->GetSigOpCountWithAncestors();
+ nSigOpCostWithAncestors = entry->GetSigOpCostWithAncestors();
}
CTxMemPool::txiter iter;
uint64_t nSizeWithAncestors;
CAmount nModFeesWithAncestors;
- unsigned int nSigOpCountWithAncestors;
+ int64_t nSigOpCostWithAncestors;
};
/** Comparator for CTxMemPool::txiter objects.
@@ -123,7 +124,7 @@ struct update_for_parent_inclusion
{
e.nModFeesWithAncestors -= iter->GetFee();
e.nSizeWithAncestors -= iter->GetTxSize();
- e.nSigOpCountWithAncestors -= iter->GetSigOpCount();
+ e.nSigOpCostWithAncestors -= iter->GetSigOpCost();
}
CTxMemPool::txiter iter;
@@ -139,12 +140,15 @@ private:
CBlock* pblock;
// Configuration parameters for the block size
- unsigned int nBlockMaxSize, nBlockMinSize;
+ bool fIncludeWitness;
+ unsigned int nBlockMaxWeight, nBlockMaxSize;
+ bool fNeedSizeAccounting;
// Information on the current status of the block
+ uint64_t nBlockWeight;
uint64_t nBlockSize;
uint64_t nBlockTx;
- unsigned int nBlockSigOps;
+ uint64_t nBlockSigOpsCost;
CAmount nFees;
CTxMemPool::setEntries inBlock;
@@ -153,7 +157,7 @@ private:
int64_t nLockTimeCutoff;
const CChainParams& chainparams;
- // Variables used for addScoreTxs and addPriorityTxs
+ // Variables used for addPriorityTxs
int lastFewTxs;
bool blockFinished;
@@ -170,14 +174,12 @@ private:
void AddToBlock(CTxMemPool::txiter iter);
// Methods for how to add transactions to a block.
- /** Add transactions based on modified feerate */
- void addScoreTxs();
/** Add transactions based on tx "priority" */
void addPriorityTxs();
/** Add transactions based on feerate including unconfirmed ancestors */
void addPackageTxs();
- // helper function for addScoreTxs and addPriorityTxs
+ // helper function for addPriorityTxs
/** Test if tx will still "fit" in the block */
bool TestForBlock(CTxMemPool::txiter iter);
/** Test if tx still has unconfirmed parents not yet in block */
@@ -187,9 +189,12 @@ private:
/** Remove confirmed (inBlock) entries from given set */
void onlyUnconfirmed(CTxMemPool::setEntries& testSet);
/** Test if a new package would "fit" in the block */
- bool TestPackage(uint64_t packageSize, unsigned int packageSigOps);
- /** Test if a set of transactions are all final */
- bool TestPackageFinality(const CTxMemPool::setEntries& package);
+ bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost);
+ /** 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 CTxMemPool::setEntries& package);
/** Return true if given transaction from mapTx has already been evaluated,
* or if the transaction's cached data in mapTx is incorrect. */
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set &mapModifiedTx, CTxMemPool::setEntries &failedTx);