Serialize effective amount #231
3 changed files with 48 additions and 18 deletions
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
#define GENESIS_MERKLE_ROOT "b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc"
|
#define GENESIS_MERKLE_ROOT "b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc"
|
||||||
|
|
||||||
#define MAINNET_GENESIS_HASH "0000678ddce6b9b57e58fab6b89a1cf63519ffb4bc097debb1836577ead9a3be"
|
#define MAINNET_GENESIS_HASH "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
|
||||||
#define MAINNET_GENESIS_NONCE 71748
|
#define MAINNET_GENESIS_NONCE 1287
|
||||||
|
|
||||||
#define REGTEST_GENESIS_HASH "6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556"
|
#define REGTEST_GENESIS_HASH "6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556"
|
||||||
#define REGTEST_GENESIS_NONCE 1
|
#define REGTEST_GENESIS_NONCE 1
|
||||||
|
|
38
src/hash.cpp
38
src/hash.cpp
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "crypto/common.h"
|
#include "crypto/common.h"
|
||||||
|
#include "crypto/ripemd160.h"
|
||||||
#include "crypto/hmac_sha512.h"
|
#include "crypto/hmac_sha512.h"
|
||||||
|
#include "crypto/sha512.h"
|
||||||
#include "pubkey.h"
|
#include "pubkey.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,10 +17,38 @@ inline uint32_t ROTL32(uint32_t x, int8_t r)
|
||||||
|
|
||||||
uint256 PoWHash(const std::vector<unsigned char>& input)
|
uint256 PoWHash(const std::vector<unsigned char>& input)
|
||||||
{
|
{
|
||||||
CHash256 h;
|
CHash256 h256;
|
||||||
h.Write(input.data(), input.size());
|
CSHA512 h512;
|
||||||
uint256 result;
|
CRIPEMD160 h160;
|
||||||
h.Finalize((unsigned char*)&result);
|
|
||||||
|
std::vector<unsigned char> out;
|
||||||
|
out.resize(h512.OUTPUT_SIZE);
|
||||||
|
|
||||||
|
std::vector<unsigned char> out_small;
|
||||||
|
out_small.resize(h160.OUTPUT_SIZE);
|
||||||
|
|
||||||
|
h256.Write(input.data(), input.size());
|
||||||
|
h256.Finalize(&out[0]);
|
||||||
|
h256.Reset();
|
||||||
|
|
||||||
|
h512.Write(out.data(), h256.OUTPUT_SIZE);
|
||||||
|
h512.Finalize(&out[0]);
|
||||||
|
|
||||||
|
|
||||||
|
h160.Write(out.data(), h512.OUTPUT_SIZE / 2);
|
||||||
|
h160.Finalize(&out_small[0]);
|
||||||
|
h160.Reset();
|
||||||
|
|
||||||
|
h256.Write(out_small.data(), h160.OUTPUT_SIZE);
|
||||||
|
|
||||||
|
h160.Write(out.data() + h512.OUTPUT_SIZE / 2, h512.OUTPUT_SIZE / 2);
|
||||||
|
h160.Finalize(&out_small[0]);
|
||||||
|
|
||||||
|
out.resize(h256.OUTPUT_SIZE);
|
||||||
|
h256.Write(out_small.data(), h160.OUTPUT_SIZE);
|
||||||
|
h256.Finalize(&out[0]);
|
||||||
|
|
||||||
|
uint256 result(out);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,17 +93,17 @@ struct {
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
const unsigned int nonces[] = {
|
const unsigned int nonces[] = {
|
||||||
79715, 115775, 224572, 12063, 35799, 81128, 7459, 3704, 74161, 174952,
|
336984, 142281, 190844, 28794, 60108, 38620, 50265, 1467, 51047, 5744,
|
||||||
179883, 1883, 24971, 12115, 7908, 24791, 78905, 135694, 24855, 6108,
|
3125, 3088, 1463, 38012, 136014, 82442, 108217, 67261, 164429, 295896,
|
||||||
45125, 6200, 326764, 105132, 1706, 243717, 3782, 90681, 130062, 7707,
|
5625, 33163, 18912, 17233, 33394, 31250, 90162, 83127, 31836, 245670,
|
||||||
77604, 62455, 49605, 21726, 119057, 27524, 73984, 1331, 51531, 38874,
|
49024, 5885, 121125, 13475, 27802, 92250, 94286, 15970, 11536, 225728,
|
||||||
52443, 99097, 36007, 27173, 88714, 287757, 235289, 353070, 239689, 1365413,
|
139479, 120543, 125802, 2277, 29409, 188078, 44811, 777656, 739940, 463139,
|
||||||
196645, 94742, 76681, 73463, 267621, 233818, 398669, 606185, 68966, 784609,
|
98442, 199176, 257878, 1071941, 201178, 3749, 103041, 184443, 32931, 95584,
|
||||||
486234, 139093, 81707, 173497, 46683, 359339, 110459, 376803, 186202, 113121,
|
170413, 218370, 215087, 795280, 232087, 74312, 551792, 105084, 93228, 202816,
|
||||||
22549, 185881, 237077, 68777, 37739, 18754, 74470, 59347, 68344, 387196,
|
142542, 309855, 83512, 136555, 514030, 246349, 687104, 210446, 58494, 164980,
|
||||||
288599, 63477, 50646, 72807, 1276757, 311156, 350217, 824070, 268004, 203189,
|
20188, 615074, 73461, 755562, 268257, 119909, 146341, 201954, 169429, 138541,
|
||||||
11127, 512344, 101745, 161626, 7476, 92476, 807780, 183217, 1406078, 4693874,
|
56238, 211463, 94796, 264180, 46875, 20947, 2127286, 1343640, 481679, 565494,
|
||||||
1143704, 89400, 277776, 1555386, 2463291, 1965076, 2377228, 170135, 112842, 118000,
|
309051, 191932, 570553, 968624, 3807762, 281065, 1186138, 1168816, 231340, 715540,
|
||||||
};
|
};
|
||||||
|
|
||||||
CBlockIndex CreateBlockIndex(int nHeight)
|
CBlockIndex CreateBlockIndex(int nHeight)
|
||||||
|
@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||||
txFirst.push_back(new CTransaction(pblock->vtx[0]));
|
txFirst.push_back(new CTransaction(pblock->vtx[0]));
|
||||||
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
|
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
|
||||||
pblock->nNonce = nonces[i];
|
pblock->nNonce = nonces[i];
|
||||||
/*bool fFound = false;
|
/* bool fFound = false;
|
||||||
for (int j = 0; !fFound; j++)
|
for (int j = 0; !fFound; j++)
|
||||||
{
|
{
|
||||||
pblock->nNonce = j;
|
pblock->nNonce = j;
|
||||||
|
|
Loading…
Reference in a new issue