Browse Source

recreate genesis

pull/5/head
orignal 8 years ago
parent
commit
3661abe86f
  1. 2
      src/hash.h
  2. 19
      src/main.cpp
  3. 4
      src/net.cpp

2
src/hash.h

@ -22,7 +22,7 @@ inline uint256 Hash(const T1 pbegin, const T1 pend) @@ -22,7 +22,7 @@ inline uint256 Hash(const T1 pbegin, const T1 pend)
uint8_t hash1[64];
i2p::crypto::GOSTR3411_2012_512 ((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), hash1);
uint256 hash2;
i2p::crypto::GOSTR3411_2012_256 (hash1, 61, hash2.begin ());
i2p::crypto::GOSTR3411_2012_256 (hash1, 64, hash2.begin ());
return hash2;
}

19
src/main.cpp

@ -32,7 +32,7 @@ CTxMemPool mempool; @@ -32,7 +32,7 @@ CTxMemPool mempool;
unsigned int nTransactionsUpdated = 0;
map<uint256, CBlockIndex*> mapBlockIndex;
uint256 hashGenesisBlock("0x00000c54d37a460c742a00cffcfbd90a07be5d31cfece2fdc8ef2cd181820939");
uint256 hashGenesisBlock("0x0000022ebc4fc755b87492cc6733b953cc08f11adca0b0e566bd67165ea17cb7");
static CBigNum bnProofOfWorkLimit( CBigNum().SetCompact(0x1e0ffff0) );
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
@ -2899,7 +2899,7 @@ bool InitBlockIndex() { @@ -2899,7 +2899,7 @@ bool InitBlockIndex() {
if (!fReindex) {
// Genesis block
const char* pszTimestamp = "26/Mar/2017: GOST R 34.11-2012 - orignal";
const char* pszTimestamp = "02/Apr/2017: GOST R 34.11-2012 - orignal";
CTransaction txNew;
txNew.vin.resize(1);
txNew.vout.resize(1);
@ -2911,13 +2911,13 @@ bool InitBlockIndex() { @@ -2911,13 +2911,13 @@ bool InitBlockIndex() {
block.hashPrevBlock = 0;
block.hashMerkleRoot = block.BuildMerkleTree();
block.nVersion = 1;
block.nTime = 1490566849;
block.nTime = 1491140178;
block.nBits = 0x1e0ffff0;
/*CBigNum n;
n.SetHex ("0000ffff00000000000000000000000000000000000000000000000000000000"); // 4
block.nBits = n.GetCompact ();
printf("nbits %x\n", block.nBits);*/
block.nNonce = 517537227;
block.nNonce = 517611960;
if (fTestNet)
{
@ -2926,7 +2926,7 @@ bool InitBlockIndex() { @@ -2926,7 +2926,7 @@ bool InitBlockIndex() {
}
// temporary code for finding nonce for genesis, should be removed later one
/*uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
printf("hash target %s\n", hashTarget.ToString().c_str());
while(true)
{
@ -2945,7 +2945,7 @@ bool InitBlockIndex() { @@ -2945,7 +2945,7 @@ bool InitBlockIndex() {
}
}
printf("block.nTime = %u \n", block.nTime);
printf("block.nNonce = %u \n", block.nNonce); */
printf("block.nNonce = %u \n", block.nNonce);
/////////////////////////////////////////////////////////////
@ -2954,7 +2954,7 @@ bool InitBlockIndex() { @@ -2954,7 +2954,7 @@ bool InitBlockIndex() {
printf("hash %s\n", hash.ToString().c_str());
printf("hashGenesisBlock %s\n", hashGenesisBlock.ToString().c_str());
printf("block.hashMerkleRoot %s\n", block.hashMerkleRoot.ToString().c_str());
assert(block.hashMerkleRoot == uint256("0x7998962bab9feadedb984f27ff3da8cf48f6ad6886c2a441f549e5c5d094e88f"));
assert(block.hashMerkleRoot == uint256("0x1cf1e5211650ba5218b5b869c48c4bc480c4fd1bc849fdc1a81d68547b9f4d58"));
block.print();
assert(hash == hashGenesisBlock);
@ -4662,8 +4662,11 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) @@ -4662,8 +4662,11 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
if (hash > hashTarget)
{
printf ("Block failed %s\n", hash.GetHex().c_str());
pblock->print ();
return false;
}
//// debug print
printf("AnoncoinMiner:\n");
printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());

4
src/net.cpp

@ -1340,8 +1340,8 @@ void MapPort(bool) @@ -1340,8 +1340,8 @@ void MapPort(bool)
static const char *strI2PDNSSeed[][2] = {
{"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p",
"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p"} // xcps
/*{"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p",
"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p"} // xcps*/
};

Loading…
Cancel
Save