]>
Commit | Line | Data |
---|---|---|
d247a5d1 | 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto |
f914f1a7 | 2 | // Copyright (c) 2009-2013 The Bitcoin Core developers |
78253fcb | 3 | // Distributed under the MIT software license, see the accompanying |
bc909a7a | 4 | // file COPYING or https://www.opensource.org/licenses/mit-license.php . |
51ed9ec9 | 5 | |
d247a5d1 JG |
6 | #ifndef BITCOIN_MINER_H |
7 | #define BITCOIN_MINER_H | |
8 | ||
2ce63d39 | 9 | #include "primitives/block.h" |
88d014d0 | 10 | #ifdef ENABLE_WALLET |
11 | #include "wallet/wallet.h" | |
12 | #endif | |
2ce63d39 | 13 | |
8e8b6d70 | 14 | #include <boost/optional.hpp> |
51ed9ec9 BD |
15 | #include <stdint.h> |
16 | ||
51ed9ec9 | 17 | class CBlockIndex; |
b2993bc5 | 18 | class CChainParams; |
51ed9ec9 | 19 | class CScript; |
30c43d98 | 20 | namespace Consensus { struct Params; }; |
d247a5d1 | 21 | |
2ce63d39 LD |
22 | struct CBlockTemplate |
23 | { | |
24 | CBlock block; | |
25 | std::vector<CAmount> vTxFees; | |
26 | std::vector<int64_t> vTxSigOps; | |
27 | }; | |
16593898 | 28 | #define KOMODO_MAXGPUCOUNT 65 |
ac14bcc1 | 29 | |
d247a5d1 | 30 | /** Generate a new block, without valid proof-of-work */ |
88d014d0 | 31 | CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& scriptPubKeyIn, int32_t gpucount=0, bool isStake=false); |
8e8b6d70 JG |
32 | #ifdef ENABLE_WALLET |
33 | boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey); | |
5034d1c1 | 34 | CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, int32_t gpucount, bool isStake = false); |
8e8b6d70 JG |
35 | #else |
36 | boost::optional<CScript> GetMinerScriptPubKey(); | |
37 | CBlockTemplate* CreateNewBlockWithKey(); | |
38 | #endif | |
c1de826f JG |
39 | |
40 | #ifdef ENABLE_MINING | |
b2993bc5 | 41 | /** Get script for -mineraddress */ |
f4055fe1 | 42 | void GetScriptForMinerAddress(boost::shared_ptr<CReserveScript> &script); |
d247a5d1 | 43 | /** Modify the extranonce in a block */ |
88d014d0 | 44 | void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, bool buildMerkle=true, uint32_t *pSaveBits=NULL); |
c1de826f | 45 | /** Run the miner threads */ |
88d014d0 | 46 | #ifdef ENABLE_WALLET |
47 | void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads); | |
48 | #else | |
49 | void GenerateBitcoins(bool fGenerate, int nThreads); | |
50 | #endif | |
c1de826f JG |
51 | #endif |
52 | ||
bebe7282 | 53 | void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev); |
d247a5d1 JG |
54 | |
55 | #endif // BITCOIN_MINER_H |