Advertisement
Guest User

Untitled

a guest
Feb 8th, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. // If genesis block hash does not match, then generate new genesis hash
  2. if (true && block.GetHash() != hashGenesisBlock)
  3. {
  4. printf("Searching for genesis block...\n");
  5.  
  6. // This will figure out a valid hash and Nonce if you're 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.  
  30. if ((block.nNonce & 0xFFF) == 0)
  31. printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
  32.  
  33. ++block.nNonce;
  34.  
  35. if (block.nNonce == 0)
  36. {
  37. printf("NONCE WRAPPED, incrementing time\n");
  38. ++block.nTime;
  39. }
  40. }
  41. printf("block.nTime = %u \n", block.nTime);
  42. printf("block.nNonce = %u \n", block.nNonce);
  43. printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement