Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | BlockAssembler::CreateNewBlock(const CScript &scriptPubKeyIn) { | ||||
if (!pblocktemplate.get()) { | if (!pblocktemplate.get()) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
// Pointer for convenience. | // Pointer for convenience. | ||||
pblock = &pblocktemplate->block; | pblock = &pblocktemplate->block; | ||||
// Add dummy coinbase tx as first transaction. It is updated at the end. | // Add dummy coinbase tx as first transaction. It is updated at the end. | ||||
pblocktemplate->entries.emplace_back(CTransactionRef(), -SATOSHI, 0, -1); | pblocktemplate->entries.emplace_back(CTransactionRef(), -SATOSHI, -SATOSHI, | ||||
0, -1); | |||||
LOCK2(cs_main, mempool->cs); | LOCK2(cs_main, mempool->cs); | ||||
CBlockIndex *pindexPrev = chainActive.Tip(); | CBlockIndex *pindexPrev = chainActive.Tip(); | ||||
assert(pindexPrev != nullptr); | assert(pindexPrev != nullptr); | ||||
nHeight = pindexPrev->nHeight + 1; | nHeight = pindexPrev->nHeight + 1; | ||||
const CChainParams &chainparams = config->GetChainParams(); | const CChainParams &chainparams = config->GetChainParams(); | ||||
pblock->nVersion = | pblock->nVersion = | ||||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | if (!ContextualCheckTransaction(*config, it->GetTx(), state, nHeight, | ||||
nLockTimeCutoff, nMedianTimePast)) { | nLockTimeCutoff, nMedianTimePast)) { | ||||
return TestForBlockResult::TXCantFit; | return TestForBlockResult::TXCantFit; | ||||
} | } | ||||
return TestForBlockResult::TXFits; | return TestForBlockResult::TXFits; | ||||
} | } | ||||
void BlockAssembler::AddToBlock(CTxMemPool::txiter iter) { | void BlockAssembler::AddToBlock(CTxMemPool::txiter iter) { | ||||
pblocktemplate->entries.emplace_back(iter->GetSharedTx(), iter->GetFee(), | pblocktemplate->entries.emplace_back( | ||||
iter->GetTxSize(), | iter->GetSharedTx(), iter->GetFee(), iter->GetModifiedFee(), | ||||
iter->GetSigOpCount()); | iter->GetTxSize(), iter->GetSigOpCount()); | ||||
nBlockSize += iter->GetTxSize(); | nBlockSize += iter->GetTxSize(); | ||||
++nBlockTx; | ++nBlockTx; | ||||
nBlockSigOps += iter->GetSigOpCount(); | nBlockSigOps += iter->GetSigOpCount(); | ||||
nFees += iter->GetFee(); | nFees += iter->GetFee(); | ||||
inBlock.insert(iter->GetTx().GetId()); | inBlock.insert(iter->GetTx().GetId()); | ||||
bool fPrintPriority = | bool fPrintPriority = | ||||
gArgs.GetBoolArg("-printpriority", DEFAULT_PRINTPRIORITY); | gArgs.GetBoolArg("-printpriority", DEFAULT_PRINTPRIORITY); | ||||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |