<commit_before>// Copyright (c) 2011-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "arith_uint256.h"
#include "consensus/validation.h"
#include "main.h"
#include "miner.h"
#include "pubkey.h"
#include "uint256.h"
#include "util.h"
#include "crypto/equihash.h"

#include "test/test_bitcoin.h"

#include <boost/test/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup)

#define NUM_EQUIHASH_SOLUTIONS 8 // k = 3

static
struct {
    const char *nonce_hex;
    uint32_t vSolutions[NUM_EQUIHASH_SOLUTIONS];
} blockinfo[] = {
    {"0000000000000000000000000000000000000000000000000000000000000000", {97743,30132657,484063,549799,19348864,23335066,22922656,25212984,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3704844,19676691,5558781,19454332,6669915,23401490,14677063,19400208,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1163066,10418279,18213323,33214736,22651636,27284477,27568170,31886880,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {9437140,11715184,19371050,28966349,16609248,24809554,21156339,24329400,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {2060808,14976084,3929233,8635606,2129994,29321978,18009732,20899603,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6553151,27547222,14374815,26966781,11572967,18515299,13425522,25942859,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3830400,31681697,8210152,12108799,6539013,7272751,8002435,18353246,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2347532,11316683,3657242,6346602,7767083,9711208,14774567,20327455,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {375375,10923448,2690587,4355326,5387974,26027068,8838706,26025107,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3085258,31739796,20142350,24205810,20852611,26722451,30903228,32829827,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {5395844,27138460,14773502,17738417,7702401,20224724,27335595,27369205,}},
    {"0000000000000000000000000000000000000000000000000000000000000004", {1902919,22420687,11555907,26533901,7140909,9533324,23456860,29031946,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6847902,22822141,22499684,28459893,8721831,21654167,15186174,27048912,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1590139,14875756,11673960,20903589,7199901,14497011,8704820,27430995,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1124558,8305774,17764744,27873733,5387634,6987439,6986181,21127745,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3197745,5825725,17977936,19348879,5874615,15887691,15017865,31597246,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {10469647,26060158,15880265,25775850,11043315,30083864,13122460,19138629,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {11010883,27697707,26476073,29000438,17504202,19922171,29822139,33063857,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3404296,23492192,8817274,29619278,8418789,14105467,17418978,30576012,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1508731,11137601,2115128,16969615,2067207,23465770,7575884,9882258,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {177353,8924531,9983009,10616028,3772765,7424649,5422939,20970804,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {320212,7857131,18308879,25253336,6561829,8589182,8966024,10570267,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {181083,31789696,24507346,26209656,7718065,22999323,10743327,31353280,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {465807,9228966,3083171,7969599,4928825,26972710,15817909,31729384,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3676,2909041,5948826,11593877,10433824,33508618,11427438,31524008,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1640081,28434654,26510595,29673164,7842550,19055553,9833590,13400268,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {1061609,15612480,7681662,30991237,19882132,29284639,25169376,30303278,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {99804,33190805,8421265,22831818,15597760,29765176,18462058,27399781,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {393632,8223856,18154872,31857036,6466434,10898122,8092016,23510083,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1168321,22320269,20146313,31053384,2136680,16384955,5347965,16673756,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6572873,29527411,6961349,22187080,13188505,15731402,26508098,30432587,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4924166,6980487,19176475,20298240,8648353,28273621,8799191,18322308,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2842168,18835810,9111204,13670859,5206568,26351703,10247067,14161373,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1140,7428267,18165632,32442656,11324427,28921953,20742626,22277053,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2377188,19710714,10547871,32643708,10404302,18785688,13079055,18715471,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {856180,18364822,7089832,29888479,10722910,18669870,22122535,32894082,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3907433,24897047,4534936,7797466,10715155,22967816,11132191,16463669,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1158847,10985791,1984321,24625094,2275980,10061803,14987747,29048783,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1313124,27847846,19551178,32271024,15895849,28869054,17547180,26443544,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1662315,12524026,6888640,27496996,7333655,15233456,12309604,25012207,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1788805,5825783,9425477,31593658,11444111,32242541,23080214,25810332,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {2538508,32602057,16694134,18822406,6729083,25625751,17569380,33186084,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {178290,20453209,5144992,10328787,6345446,26439712,14656409,15726547,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {999921,16132813,3186087,11047015,3534048,4930850,7305627,21301240,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2548772,3363393,21706776,31686311,14614075,27114655,22343013,32107261,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {740515,26901858,12687793,31790705,1690282,7959602,3805504,25476964,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {912272,19107394,2828728,28392925,1676293,3269042,5935967,16052535,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1879164,14761835,20935337,27097296,23971052,26699336,25380084,26237031,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {428872,30650130,7842851,18041619,810070,9893203,23497766,24044141,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3041035,11729659,4346845,24654869,8299008,19199980,12708456,13113057,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {279352,22425147,6920303,12396944,7181346,22615426,7234243,31260044,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2642203,26353464,6990714,20461271,3859654,26044145,7003288,10950283,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {69721,2003244,3433727,16788763,11137223,22692583,25917212,28264898,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {827361,14757187,12173872,32927653,4834580,16014323,28522559,32720842,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {943082,26125428,7063890,12689201,19366814,29929114,20021732,23723681,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2345325,11820207,4536851,32283539,6108863,8350508,14558654,27427717,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {379670,20128453,18366504,22664728,2539170,11976200,14142317,21628231,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2224626,12595113,13278637,22210479,5804387,10218802,25593718,32524722,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1258057,22452082,23017388,26124428,7859519,13551906,17990962,21957359,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {9072862,18661859,17472368,21283456,16167224,24215261,22615447,28419440,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {324128,23482316,6387287,18783001,1027618,18277617,23304693,32909066,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {726841,22091586,4707954,9012045,18174370,26925115,19667216,28271947,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6483973,11911695,30612326,32606885,13729745,20313064,27823097,33023741,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {271633,25251940,1551390,14796372,9225743,32098496,13649799,25998208,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4077520,22355925,9637752,30500696,15798234,32393429,19650327,25852691,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {628461,19694351,16549678,24252512,18473404,28936053,18732469,19101118,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5074185,16255586,33416220,33476906,6397497,9343800,18135165,25731401,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2617008,3320422,10084397,24518906,3158345,29451440,13200984,27878786,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1912945,9445790,16354788,31126073,5743413,10976421,16228101,22853225,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {4432996,15508567,14297344,33399602,18160067,20997003,25843025,33480466,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {445614,609785,29644824,31224472,1839565,21164124,6783649,10669305,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {584483,20375592,9768355,22723677,6409108,19606833,10334066,20651287,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1516393,2834213,15969993,28842985,2791251,5698434,30633491,33418737,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4169681,7798686,24930841,26067909,6436856,10356829,18755059,20202877,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {597623,30693250,13226060,26024715,6136533,33518750,17855976,19074153,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {787970,14793171,8299648,31091678,1655550,22351161,12333408,14598544,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1111500,14103714,5246332,25430530,5521024,17003503,10668446,22070268,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6057501,22294380,8135795,33259648,6998249,8031836,22346743,22903931,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {896965,12013733,15857331,26117022,5023142,6107703,17790821,27388113,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {15073914,26886328,18131701,18591331,16607610,26669160,18609534,22370025,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {630127,4805826,1058189,13200575,6187595,6465800,20904724,30542083,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3081952,30329585,8807240,32684619,11381758,23263447,19399856,33082704,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2142018,21724119,7811869,24398105,3966578,28142144,14104322,29508481,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2874547,30802580,15892355,22003984,9346208,18178692,14076304,20733888,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {779844,18706159,28895671,31803912,10184018,28298709,20777057,27940184,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {10859544,32356399,25045820,29204699,12535111,29771035,17779397,20293821,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2236797,24188729,26471954,31067490,20790752,25499712,27964953,30534637,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2569923,33091378,14013336,31245271,3494782,29723492,13410015,22620131,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {9760213,26449094,24273305,32591923,18561773,32580017,31879094,33248534,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {94257,5369755,19980716,32932183,8406229,20368558,17504990,20181390,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {510146,7533784,1891615,13054235,6705711,20187878,27010433,32053536,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2166293,20065304,14414805,21032397,4133862,23019683,6531714,7126905,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1041778,4456065,5358631,13763143,7577200,26665229,24068796,28800398,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {937582,26826308,28058792,28694768,5189727,19372397,15614322,16105488,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4521500,6966737,6323323,13862143,11485955,12307184,11629729,26024368,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {9040844,21264220,14276904,24928489,19506656,30369558,27472157,27786434,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1614072,27004142,14105308,32866905,5852759,27596517,26864322,30651762,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {6202568,10379593,16337809,31904445,7415075,15097878,17352682,23565977,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {10572238,22741016,11410795,26024250,12178838,26399921,18113727,27056540,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {17757,2573951,8211950,24719701,2117286,11676185,6515678,25435925,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1574654,20492089,10353675,29134399,10903399,17528416,17768662,26623799,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2696594,32385619,9085580,18428083,13894117,32532539,16764630,30477048,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {566464,19542928,11742509,23529539,16553277,32987568,20939994,29146760,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2493469,11900665,10188594,27320996,16250998,33188477,28435414,30583363,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5722857,30015694,24112853,28247326,21832584,28338357,26816419,32122301,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1734816,3552535,9674546,27191644,3451938,22052830,10479347,18547655,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3087729,17246853,12037147,16883103,6833770,31054683,12987022,15748037,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {8229812,16931970,30132685,30164944,9206203,31075410,19923587,33312205,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2481700,27601048,4684063,18020803,16501451,17797310,23596122,33335733,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3778911,19607199,16603727,20456918,7209095,31778215,9795558,18557070,}},
};

// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
    CScript scriptPubKey = CScript() << ParseHex("<KEY>") << OP_CHECKSIG;
    CBlockTemplate *pblocktemplate;
    CMutableTransaction tx,tx2;
    CScript script;
    uint256 hash;

    LOCK(cs_main);
    fCheckpointsEnabled = false;

    // We can't make transactions until we have inputs
    // Therefore, load 100 blocks :)
    std::vector<CTransaction*>txFirst;
    for (unsigned int i = 0; i < sizeof(blockinfo)/sizeof(*blockinfo); ++i)
    {
        // Simple block creation, nothing special yet:
        BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));

        CBlock *pblock = &pblocktemplate->block; // pointer for convenience
        pblock->nVersion = 1;
        pblock->nTime = chainActive.Tip()->GetMedianTimePast()+1;
        CMutableTransaction txCoinbase(pblock->vtx[0]);
        txCoinbase.vin[0].scriptSig = CScript();
        txCoinbase.vin[0].scriptSig.push_back((unsigned char) 0);
        txCoinbase.vin[0].scriptSig.push_back(chainActive.Height());<commit_msg>Update miner tests for platform-independent Equihash<commit_after>// Copyright (c) 2011-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "arith_uint256.h"
#include "consensus/validation.h"
#include "main.h"
#include "miner.h"
#include "pubkey.h"
#include "uint256.h"
#include "util.h"
#include "crypto/equihash.h"

#include "test/test_bitcoin.h"

#include <boost/test/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup)

#define NUM_EQUIHASH_SOLUTIONS 8 // k = 3

static
struct {
    const char *nonce_hex;
    uint32_t vSolutions[NUM_EQUIHASH_SOLUTIONS];
} blockinfo[] = {
    {"0000000000000000000000000000000000000000000000000000000000000000", {1505683,9304455,10114563,22791213,4035556,9345213,16397229,25618807,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {424096,20333317,10622499,20209226,6884666,27470139,23474454,30531201,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2179663,27008838,7162220,11963499,5092907,18014816,28361015,31223796,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {303751,21454192,8761201,12598180,4577837,29015619,20421055,22955596,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1751790,19856152,8574507,16953069,4251312,13393763,5955453,28913023,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {785184,14253319,24484102,27390835,1317570,12730552,16069105,29576909,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1718219,27413934,2674938,15453490,13954323,25472379,16189626,19128343,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {629365,1981622,1749373,24877483,8217463,18016882,14658154,27211901,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1688422,3318138,17890535,32625825,12604028,31950324,14297499,19466358,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6533168,12680284,12068506,12751411,12567359,27540043,12768573,16069354,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {968090,8442388,1117421,7976193,14006881,31798833,18085134,20401083,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3514701,12360162,5234778,5999621,11789340,18832893,22869850,23439344,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2575979,27830265,13819669,22742927,3121997,13349293,6263893,15290297,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5062267,7659171,14486124,23330332,11966804,24824323,14038938,18878817,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {11213446,20265755,12893621,23017856,16734884,31765345,21333472,23827684,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {5518261,30764760,12823014,13655635,7134888,32813890,11382973,17173863,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {664025,15589977,1951845,15881472,1451881,20455835,14830157,31859267,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1381023,8353598,5447556,7981905,3286916,28307849,12223998,24222776,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2270156,9693893,7097804,33155995,5209943,24608558,23175278,23996312,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {598743,7549066,12220120,16548000,1187946,6360178,9203030,20938470,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {7169872,31048822,17475729,28022573,14929725,33419266,19983803,21561441,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {823149,1383285,2864831,18895121,4028941,6686607,23910447,28604567,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2182559,17932563,5472524,13379261,8567276,32616974,13001732,29914746,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {8611685,24932345,31206257,33073835,19148378,25317035,19310180,22845583,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {83068,29700240,3972272,6850295,9153017,29691329,22889643,28586890,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2036436,33222933,10430117,26029089,14468206,23205454,16914535,23655899,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {54367,28431614,4046008,18177082,6036369,11490568,10955988,30899748,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2546890,18985534,25329149,33071236,4813628,14855283,9753607,18836650,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {10805583,19004556,28249173,32689480,11182279,15314398,16390145,19761642,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {165667,26786566,1226777,1745893,3573753,20991068,16300414,25762822,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {62918,4072570,4440776,26738888,3934004,19477034,20612480,32574298,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1719533,12082749,11189320,14802151,1932592,6082360,3182419,15839619,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3264146,31555777,9558781,24052145,3492269,12679179,20287639,24428614,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {9620201,29437274,12503846,23031898,12057554,20334741,13655193,19216975,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {7885417,28251852,18863119,30898457,15346252,26882297,18476594,21100099,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {240010,13062691,13209296,15801269,5482499,6697795,20389947,30871777,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1069937,5009862,20476681,21883864,3816975,18168447,12966753,27204663,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {4720504,28475581,30132313,32996687,15421528,33006056,19410498,32808177,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3375419,19887018,3583901,18414401,4072420,5558293,9497494,22664087,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2812898,30205959,7980517,16869166,10455874,11175055,28088879,29386025,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {91377,8095055,15028975,21569250,7121267,23141695,10638134,22152880,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5320074,19134224,5908808,20417182,9802516,29176362,11327661,27117599,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2304141,20069153,19299006,32940065,4897139,26940432,31702454,32395918,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2183041,9634135,32043677,33261946,18256807,30835923,19504088,20654921,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {7646265,16434464,9910305,18212419,12149694,22678629,32034346,32963185,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {924537,5073683,1803756,28393103,21164203,30767320,21433406,22064835,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2606837,19557323,21550527,21601365,6848017,22514207,25667860,30755108,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {131529,17520841,8190594,12399429,1736902,29945839,25566017,31113393,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {74277,30398806,5823084,26201084,4363661,31286936,8937184,25310621,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5629775,21833920,16203890,25997616,6778531,10871927,26779945,32073815,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {7360230,29863781,8172797,25440735,9306446,31827129,10966698,20794387,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1020818,19742792,2996289,3324122,4671579,8811651,9334761,25096551,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {6257905,25988186,21198798,27940315,11405239,18843426,13218595,16970291,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3661427,29865559,4313400,13731482,5384386,9968554,13573546,18976286,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {297493,14307372,3086420,11769568,1531156,33417896,16891836,26835748,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {850439,939868,16088315,17847062,1459858,18852207,21613990,31341287,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1498173,5659035,3580647,9784724,7042945,27605458,13983089,21772555,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {265300,25657381,5837906,32684326,6197029,26496479,11782433,28354118,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4235902,8416342,16760709,18644724,9088314,21041118,16132732,19921969,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {7054865,20285428,13191729,31228813,7505236,24662594,21292235,27185614,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {805354,2124453,6739370,31189471,19047536,20922898,19270405,25919260,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1250066,15110709,6902216,30436877,17319807,22578956,25091517,30273798,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {5860838,12990745,6387378,25809956,16172365,27030579,20735436,22490295,}},
    {"0000000000000000000000000000000000000000000000000000000000000003", {2907633,29738850,19732451,33309735,11787163,13756425,15433747,25267074,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5804619,14577145,23001890,25863602,15458582,17688201,21112935,29728563,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1688425,18136649,4537229,13269806,3269606,8593962,12360926,33488147,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1665070,25244052,10550119,32208768,5137014,8320231,16775388,27839194,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {8311110,18046143,12839548,22041548,13420948,13944339,18677700,30812557,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4390682,27036744,19696521,24884392,4681756,23237938,25816582,32996775,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1477153,6568369,21857553,29435914,6140396,22576862,7262979,19002076,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2965409,8684457,14803533,17967084,5354409,24881786,11719903,14361443,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {5102862,17625845,28100560,28357633,17222636,18254369,18018129,30189744,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {5708850,27621214,13753873,29665262,12657384,30563632,17310655,27915369,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {2621572,12689538,4630982,29901889,3629010,6756957,3677965,30610562,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {6500643,24447105,7448249,19069836,7887394,13551853,20649165,28423060,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {2036368,6750468,15795769,15825950,19238166,20733230,26877439,27642252,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1652218,13634797,12191514,32332965,6697455,11150626,14892178,19111832,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {111950,30863388,8779039,26464089,10089865,12353207,11894521,14091302,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3078281,23872429,20954798,21282269,4882746,21043227,7172181,33550236,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3503224,25625938,18816585,29803345,3951932,12591146,6670269,15890043,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {605872,33319409,1817073,12822625,20032228,27403095,23666911,27183623,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1766741,14384326,5278687,22979584,2203181,32152823,3183017,10965482,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {3169640,23411466,3176871,23877547,16430704,19991138,24227956,28550729,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {233750,13283920,15875314,27705359,6749492,16980557,13229511,13859447,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1077756,26076907,2621177,14078132,4915880,8647511,29725443,32637495,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1752795,25529160,13826361,21067812,6077322,28675496,24371900,30366250,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1546413,6490653,19447435,27055625,9234404,9968283,20817365,28434279,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2468906,31932096,3450912,22420554,6120742,15406354,30836680,32518512,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2123031,24896642,7125942,24921615,12317438,24914782,14264318,32418155,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {3353184,6915242,5315514,15444924,6518261,16708409,24086722,25093861,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {857291,31955694,8619476,13282852,5131527,18688880,19863466,19950736,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1739656,25530805,3754388,6793402,15290893,29035753,29565345,30305622,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {2611937,27825146,10822599,15545335,5617357,29278495,15877832,17901616,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {3831314,7379114,18116475,23520810,14414038,21954620,18383396,27660414,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {7130501,27003497,14460801,23267542,9842198,21710006,20485258,25867107,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {2508815,15933718,29539325,32090536,4829668,10149214,26025842,27744647,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {279100,29887493,785496,18973521,2321564,14770369,20866351,31894781,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1699206,29970967,5475930,14850478,4783802,13945615,16786338,16900692,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1744255,6901279,7349326,32108795,3573261,15043801,16532064,22293749,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1559827,5877322,1737945,18114144,3789777,18167812,18370250,31124870,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1116048,17556996,8840198,29420603,20557703,20953366,30328439,30663015,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {798196,16377273,22015317,22772453,5946638,18262318,13868482,23874803,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {257224,19262005,22082724,22118460,7866566,25856702,14611593,20556202,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1155318,18602392,18835625,19453594,15574365,25501175,26620735,29546443,}},
    {"0000000000000000000000000000000000000000000000000000000000000004", {1118617,21836063,21221995,26806476,18126093,20913596,18777695,32729986,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {4113293,20842387,8047389,14992088,5113685,11404673,19908238,27527216,}},
    {"0000000000000000000000000000000000000000000000000000000000000001", {1907186,28213894,13785483,22598351,2314631,32975665,17852278,26847039,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {1452278,11354301,1662083,19787092,1800371,12918477,22475783,23758259,}},
    {"0000000000000000000000000000000000000000000000000000000000000000", {219653,29803795,9124713,9874906,14412340,23444473,16935535,21346968,}},
    {"0000000000000000000000000000000000000000000000000000000000000002", {17292969,19730374,18717002,28865642,20109525,30112035,20906344,26953734,}},
};

// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
    CScript scriptPubKey = CScript() << ParseHex("<KEY>") << OP_CHECKSIG;
    CBlockTemplate *pblocktemplate;
    CMutableTransaction tx,tx2;
    CScript script;
    uint256 hash;

    LOCK(cs_main);
    fCheckpointsEnabled = false;

    // We can't make transactions until we have inputs
    // Therefore, load 100 blocks :)
    std::vector<CTransaction*>txFirst;
    for (unsigned int i = 0; i < sizeof(blockinfo)/sizeof(*blockinfo); ++i)
    {
        // Simple block creation, nothing special yet:
        BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));

        CBlock *pblock = &pblocktemplate->block; // pointer for convenience
        pblock->nVersion = 1;
        pblock->nTime = chainActive.Tip()->GetMedianTimePast()+1;
        CMutableTransaction txCoinbase(pblock->vtx[0]);
        txCoinbase.vin[0].scriptSig = CScript();
        txCoinbase.vin[0].scriptSig.push_back((unsigned char) 0);
        txCoinbase.vin[0].scriptSig.push_back(chainActive.Height());
{'fraction_non_alphanumeric': 0.11016242073645567, 'fraction_numerical': 0.766408944265213, 'mean_word_length': 16.65193912616593, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 220, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1747073', 'n_tokens_mistral': 31824, 'n_tokens_neox': 10563, 'n_words': 704}