6 #ifndef FABCOIN_MINER_H 7 #define FABCOIN_MINER_H 10 #include <libgpusolver/gpuconfig.h> 15 #include <boost/multi_index_container.hpp> 16 #include <boost/multi_index/ordered_index.hpp> 27 static const bool DEFAULT_GENERATE =
false;
28 static const int DEFAULT_GENERATE_THREADS = 1;
30 static const bool DEFAULT_PRINTPRIORITY =
false;
34 static const int32_t BYTECODE_TIME_BUFFER = 6;
36 static const int32_t POW_MINER_MAX_TIME = 60;
52 nSizeWithAncestors = entry->GetSizeWithAncestors();
53 nModFeesWithAncestors = entry->GetModFeesWithAncestors();
54 nSigOpCostWithAncestors = entry->GetSigOpCostWithAncestors();
89 bool fAHasCreateOrCall = a.
iter->GetTx().HasCreateOrCall();
90 bool fBHasCreateOrCall = b.
iter->GetTx().HasCreateOrCall();
93 if(fAHasCreateOrCall || fBHasCreateOrCall) {
96 if(fAHasCreateOrCall != fBHasCreateOrCall) {
97 return fAHasCreateOrCall ?
false :
true;
117 if(a.
iter->GetMinGasPrice() != b.
iter->GetMinGasPrice()) {
118 return a.
iter->GetMinGasPrice() > b.
iter->GetMinGasPrice();
122 if(a.
iter->GetTxSize() != b.
iter->GetTxSize()) {
123 return a.
iter->GetTxSize() < b.
iter->GetTxSize();
146 if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
147 return a->GetCountWithAncestors() < b->GetCountWithAncestors();
152 typedef boost::multi_index_container<
154 boost::multi_index::indexed_by<
155 boost::multi_index::ordered_unique<
160 boost::multi_index::ordered_non_unique<
162 boost::multi_index::tag<ancestor_score_or_gas_price>,
163 boost::multi_index::identity<CTxMemPoolModifiedEntry>,
169 typedef indexed_modified_transaction_set::nth_index<0>::type::iterator
modtxiter;
170 typedef indexed_modified_transaction_set::index<ancestor_score_or_gas_price>::type::iterator
modtxscoreiter;
227 uint64_t minGasPrice = 1;
240 std::unique_ptr<CBlockTemplate> CreateNewBlock(
const CScript& scriptPubKeyIn,
bool fMineWitnessTx=
true, int64_t* pTotalFees = 0, int32_t nTime=0, int32_t nTimeLimit=0);
255 void addPackageTxs(
int &nPackagesSelected,
int &nDescendantsUpdated, uint64_t minGasPrice);
258 void RebuildRefundTransaction();
264 bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost);
293 #endif // FABCOIN_MINER_H indexed_modified_transaction_set::nth_index< 0 >::type::iterator modtxiter
Comparator for CTxMemPool::txiter objects.
unsigned int nBlockMaxWeight
bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) const
uint64_t hardBlockGasLimit
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
CMutableTransaction originalRewardTx
CTxMemPool::setEntries inBlock
std::unique_ptr< CBlockTemplate > pblocktemplate
void GenerateFabcoins(bool fGenerate, int nThreads, const CChainParams &chainparams)
Run the miner threads.
std::set< txiter, CompareIteratorByHash > setEntries
CChainParams defines various tweakable parameters of a given instance of the Fabcoin system...
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
int64_t CAmount
Amount in lius (Can be negative)
std::vector< int64_t > vTxSigOpsCost
boost::multi_index_container< CTxMemPoolModifiedEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< modifiedentry_iter, CompareCTxMemPoolIter >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ancestor_score_or_gas_price >, boost::multi_index::identity< CTxMemPoolModifiedEntry >, CompareModifiedEntry > >> indexed_modified_transaction_set
void Scan_nNonce_nSolution(CBlock *pblock, unsigned int n, unsigned int k)
CTxMemPool::txiter result_type
const CChainParams & chainparams
update_for_parent_inclusion(CTxMemPool::txiter it)
Generate a new block, without valid proof-of-work.
std::vector< CAmount > vTxFees
Parameters that influence chain consensus.
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
indexed_transaction_set::nth_index< 0 >::type::iterator txiter
uint64_t softBlockGasLimit
uint64_t nSizeWithAncestors
ByteCodeExecResult bceResult
Construct a new block template with coinbase to scriptPubKeyIn.
uint64_t nBlockSigOpsCost
CAmount nModFeesWithAncestors
void creategenesisblock(uint32_t nTime, uint32_t nBits)
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
int64_t nSigOpCostWithAncestors
Fee rate in liu per kilobyte: CAmount / kB.
CTxMemPoolModifiedEntry(CTxMemPool::txiter entry)
A mutable version of CTransaction.
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, unsigned int &nExtraNonce)
Modify the extranonce in a block.
std::vector< unsigned char > vchCoinbaseCommitment
indexed_modified_transaction_set::index< ancestor_score_or_gas_price >::type::iterator modtxscoreiter