mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
added nouce calculation
This commit is contained in:
parent
b361105046
commit
b3b594039d
34
src/main.cpp
34
src/main.cpp
@ -31,7 +31,7 @@ CTxMemPool mempool;
|
||||
unsigned int nTransactionsUpdated = 0;
|
||||
|
||||
map<uint256, CBlockIndex*> mapBlockIndex;
|
||||
uint256 hashGenesisBlock("0x61a8e2e4a21ff79a135f0928e958ef3e9d8031f52a977ac0f49cfd9cecb33cf6");
|
||||
uint256 hashGenesisBlock("0xa8f2c5db0ff04ecc771dc58964473b5d565902628b05b13130f157dab27701ba");
|
||||
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Xcoin: starting difficulty is 1 / 2^12
|
||||
CBlockIndex* pindexGenesisBlock = NULL;
|
||||
int nBestHeight = -1;
|
||||
@ -2770,7 +2770,7 @@ bool InitBlockIndex() {
|
||||
block.nVersion = 1;
|
||||
block.nTime = 1389401959;
|
||||
block.nBits = 0x1e0ffff0;
|
||||
block.nNonce = 1084524493;
|
||||
block.nNonce = 17355177984;
|
||||
|
||||
if (fTestNet)
|
||||
{
|
||||
@ -2778,6 +2778,36 @@ bool InitBlockIndex() {
|
||||
block.nNonce = 385270584;
|
||||
}
|
||||
|
||||
if (true && block.GetHash() != hashGenesisBlock)
|
||||
{
|
||||
printf("Searching for genesis block...\n");
|
||||
// This will figure out a valid hash and Nonce if you're
|
||||
// creating a different genesis block:
|
||||
uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
|
||||
uint256 thash;
|
||||
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
|
||||
|
||||
loop
|
||||
{
|
||||
scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
|
||||
if (thash <= hashTarget)
|
||||
break;
|
||||
if ((block.nNonce & 0xFFF) == 0)
|
||||
{
|
||||
printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
|
||||
}
|
||||
++block.nNonce;
|
||||
if (block.nNonce == 0)
|
||||
{
|
||||
printf("NONCE WRAPPED, incrementing time\n");
|
||||
++block.nTime;
|
||||
}
|
||||
}
|
||||
printf("block.nTime = %u \n", block.nTime);
|
||||
printf("block.nNonce = %u \n", block.nNonce);
|
||||
printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
|
||||
}
|
||||
|
||||
//// debug print
|
||||
uint256 hash = block.GetHash();
|
||||
printf("%s\n", hash.ToString().c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user