コード例 #1
0
void RunSimulation(boost::function<double(const CBlockIndex*)>* hashRate, int startHeight, int iterations)
{
    CBlockIndex* tip = NULL;
    double rate[5];
    for(int i=0; i<5; i++)
        rate[i]=hashRate[i](tip);
    SimulationSetup(tip, rate, startHeight);
    printf("begin simulation:\n");
    for(int it=0; it<iterations; it++)
    {
        for(int i=0; i<5; i++)
            rate[i]=hashRate[i](tip);
        SimulateNextBlock(tip, rate);

        double diffsum=0;
        for(int i=0; i<5; i++)
            diffsum+=BitsToDifficulty(GetNextWorkRequired(tip, NULL, i));
        
        printf("height %d algo %7s time %3d diff %8.3f, avg next diff %7.3f\n", 
            tip->nHeight,
            GetAlgoName(GetAlgo(tip->nVersion)).c_str(), 
            tip->nTime - tip->pprev->nTime, 
            BitsToDifficulty(tip->nBits), diffsum/5);
    }
}
コード例 #2
0
ファイル: core.cpp プロジェクト: 0rkaM/Gridcoin-master
void CBlock::print() const
{
    printf("CBlock(hash=%s, ver=%d, pow_algo=%d, pow_hash=%s, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n",
        GetHash().ToString().c_str(),
        nVersion, GetAlgo(),
        GetPoWHash(GetAlgo()).ToString().c_str(),
        hashPrevBlock.ToString().c_str(),
        hashMerkleRoot.ToString().c_str(),
        nTime, nBits, nNonce,
        vtx.size());
    for (unsigned int i = 0; i < vtx.size(); i++)
    {
        printf("  ");
        vtx[i].print();
    }
    printf("  vMerkleTree: ");
    for (unsigned int i = 0; i < vMerkleTree.size(); i++)
        printf("%s ", vMerkleTree[i].ToString().c_str());
    printf("\n");
}
コード例 #3
0
ファイル: DrawJES.C プロジェクト: affablelochan/2013codev2
Str GetJetDesc(Str jA) { return GetAlgo(jA)+" "+GetJetR(jA)+", "+GetCalib(jA); }