View difference between Paste ID: jDMPUNuP and dZCcDkUp
SHOW: | | - or go back to the newest paste.
1
        // If genesis block hash does not match, then generate new genesis hash.
2-
        if (false && block.GetHash() != hashGenesisBlock)
2+
        if (true && block.GetHash() != hashGenesisBlock)
3
        {
4
            printf("Searching for genesis block...\n");
5
            // This will figure out a valid hash and Nonce if you're
6
            // creating a different genesis block:
7
            uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
8
            uint256 thash;
9
            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
10
11
            loop
12
            {
13
#if defined(USE_SSE2)
14
                // Detection would work, but in cases where we KNOW it always has SSE2,
15
                // it is faster to use directly than to use a function pointer or conditional.
16
#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
17
                // Always SSE2: x86_64 or Intel MacOS X
18
                scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
19
#else
20
                // Detect SSE2: 32bit x86 Linux or Windows
21
                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
22
#endif
23
#else
24
                // Generic scrypt
25
                scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
26
#endif
27
                if (thash <= hashTarget)
28
                    break;
29
                if ((block.nNonce & 0xFFF) == 0)
30
                {
31
                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
32
                }
33
                ++block.nNonce;
34
                if (block.nNonce == 0)
35
                {
36
                    printf("NONCE WRAPPED, incrementing time\n");
37
                    ++block.nTime;
38
                }
39
            }
40
            printf("block.nTime = %u \n", block.nTime);
41
            printf("block.nNonce = %u \n", block.nNonce);
42
            printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
43
        }