Myriadcoin

This commit is contained in:
myriadcoin
2014-02-23 18:52:46 +02:00
parent 5a60784411
commit f1a9ebbdc8
102 changed files with 4990 additions and 4828 deletions
+18 -8
View File
@@ -44,7 +44,7 @@ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
/** Fake height value used in CCoins to signify they are only in the memory pool (since 0.8) */
static const unsigned int MEMPOOL_HEIGHT = 0x7FFFFFFF;
/** No amount larger than this (in satoshi) is valid */
static const int64 MAX_MONEY = 200000000 * COIN;
static const int64 MAX_MONEY = 2000000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;
@@ -64,8 +64,7 @@ static const int fHaveUPnP = false;
extern CScript COINBASE_FLAGS;
extern int miningAlgo;
extern CCriticalSection cs_main;
@@ -162,7 +161,7 @@ void ThreadScriptCheck();
/** Run the miner threads */
void GenerateBitcoins(bool fGenerate, CWallet* pwallet);
/** Generate a new block, without valid proof-of-work */
CBlockTemplate* CreateNewBlock(CReserveKey& reservekey);
CBlockTemplate* CreateNewBlock(CReserveKey& reservekey, int algo);
/** Modify the extranonce in a block */
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
/** Do mining precalculation */
@@ -170,7 +169,7 @@ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash
/** Check mined block */
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey);
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
bool CheckProofOfWork(uint256 hash, unsigned int nBits, int algo);
/** Calculate the minimum amount of work a received block needs, without knowing its direct parent */
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime);
/** Get the number of active peers */
@@ -203,8 +202,6 @@ bool AbortNode(const std::string &msg);
bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
struct CDiskBlockPos
@@ -666,6 +663,8 @@ public:
}
};
extern CCriticalSection cs_LastBlockFile;
extern CBlockFileInfo infoLastBlockFile;
extern int nLastBlockFile;
@@ -774,6 +773,8 @@ public:
nBits = block.nBits;
nNonce = block.nNonce;
}
int GetAlgo() const { return ::GetAlgo(nVersion); }
CDiskBlockPos GetBlockPos() const {
CDiskBlockPos ret;
@@ -836,7 +837,11 @@ public:
bool CheckIndex() const
{
return CheckProofOfWork(GetBlockHash(), nBits);
int algo = GetAlgo();
if (algo == ALGO_SHA256D)
return CheckProofOfWork(GetBlockHash(), nBits, algo);
else
return true;
}
enum { nMedianTimeSpan=11 };
@@ -871,8 +876,10 @@ public:
* Returns true if there are nRequired or more blocks of minVersion or above
* in the last nToCheck blocks, starting at pstart and going backwards.
*/
/*
static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart,
unsigned int nRequired, unsigned int nToCheck);
*/
std::string ToString() const
{
@@ -902,6 +909,9 @@ struct CBlockIndexWorkComparator
};
const CBlockIndex* GetLastBlockIndex(const CBlockIndex* pindex, int algo);
const CBlockIndex* GetLastBlockIndexForAlgo(const CBlockIndex* pindex, int algo);
/** Used to marshal pointers into hashes for db storage. */
class CDiskBlockIndex : public CBlockIndex