This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*- | |
* Copyright 2009 Colin Percival | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int static KimotoGravityWell(const CBlockIndex * pindexLast, const CBlockHeader * pblock, uint64 TargetBlocksSpacingSeconds, uint64 PastBlocksMin, uin\ | |
t64 PastBlocksMax) | |
{ | |
/* current difficulty formula, megacoin - kimoto gravity well */ | |
const CBlockIndex *BlockLastSolved = pindexLast; | |
const CBlockIndex *BlockReading = pindexLast; | |
const CBlockHeader *BlockCreating = pblock; | |
BlockCreating = BlockCreating; | |
uint64PastBlocksMass = 0; | |
int64PastRateActualSeconds = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
struct float_ext80 { | |
unsigned long long int sign; | |
short exp; // top bit is signed bit of the significand | |
char dummy[6]; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep 'BOOST_AUTO_TEST_SUITE(' * -RI | sed -e "s|^.*(\(.*\)).*$|./test_bitcoin --run_test=\1|" | |
./test_bitcoin --run_test=accounting_tests | |
./test_bitcoin --run_test=allocator_tests | |
./test_bitcoin --run_test=base32_tests | |
./test_bitcoin --run_test=base58_tests | |
./test_bitcoin --run_test=base64_tests | |
./test_bitcoin --run_test=bignum_tests | |
./test_bitcoin --run_test=bip32_tests | |
./test_bitcoin --run_test=bloom_tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
if (pcheckpoint && pblock->hashPrevBlock != hashBestChain && !Checkpoints::WantedByPendingSyncCheckpoint(hash)) | |
{ | |
// Extra checks to prevent "fill up memory by spamming with bogus blocks" | |
int64_t deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; | |
CBigNum bnNewBlock; | |
bnNewBlock.SetCompact(pblock->nBits); | |
CBigNum bnRequired; | |
if (pblock->IsProofOfStake()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extra checks to prevent "fill up memory by spamming with bogus blocks" | |
int64_t deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; | |
CBigNum bnNewBlock; | |
bnNewBlock.SetCompact(pblock->nBits); | |
CBigNum bnRequired; | |
if (pblock->IsProofOfStake()) | |
bnRequired.SetCompact(ComputeMinStake(GetLastBlockIndex(pcheckpoint, true)->nBits, deltaTime, pblock->nTime)); | |
else | |
bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, false)->nBits, deltaTime)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) | |
{ | |
unsigned int nProofOfWorkLimit = Params().ProofOfWorkLimit().GetCompact(); | |
int nHeight = pindexLast->nHeight + 1; | |
int64_t retargetTimespan = nTargetTimespanRe;// 60 | |
int64_t retargetSpacing = nTargetSpacingRe; // 60 | |
int64_t retargetInterval = nIntervalRe; // 1 |