Merge pull request #247 from jl777/dev

Dev
This commit is contained in:
jl777
2017-03-13 14:16:43 +02:00
committed by GitHub
5 changed files with 14 additions and 14 deletions

View File

@@ -614,7 +614,7 @@ void komodo_bannedset(uint256 *array,int32_t max)
array[i] = uint256S(banned_txids[i]); array[i] = uint256S(banned_txids[i]);
if ( i != max ) if ( i != max )
printf("banned txid array error i.%d != max.%d\n",i,max); printf("banned txid array error i.%d != max.%d\n",i,max);
else printf("set %d banned txids\n",max); //else printf("set %d banned txids\n",max);
} }
int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing

View File

@@ -1527,7 +1527,7 @@ bool IsInitialBlockDownload()
} }
bool state; bool state;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
state = (chainActive.Height() < pindexBestHeader->nHeight - 24*6) || state = (chainActive.Height() > 236000 && chainActive.Height() < pindexBestHeader->nHeight - 24*6) ||
pindexBestHeader->GetBlockTime() < (GetTime() - chainParams.MaxTipAge()); pindexBestHeader->GetBlockTime() < (GetTime() - chainParams.MaxTipAge());
else state = (chainActive.Height() < pindexBestHeader->nHeight - 100); else state = (chainActive.Height() < pindexBestHeader->nHeight - 100);
if (!state) if (!state)
@@ -3206,7 +3206,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
int nHeight = pindexPrev->nHeight+1; int nHeight = pindexPrev->nHeight+1;
// Check proof of work // Check proof of work
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) if ( (nHeight < 235300 || nHeight > 236000) && block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
{ {
cout << block.nBits << " block.nBits vs. calc " << GetNextWorkRequired(pindexPrev, &block, consensusParams) << endl; cout << block.nBits << " block.nBits vs. calc " << GetNextWorkRequired(pindexPrev, &block, consensusParams) << endl;
return state.DoS(100, error("%s: incorrect proof of work", __func__), return state.DoS(100, error("%s: incorrect proof of work", __func__),
@@ -3413,7 +3413,7 @@ bool ProcessNewBlock(int32_t height,CValidationState &state, CNode* pfrom, CBloc
fRequested |= fForceProcessing; fRequested |= fForceProcessing;
if (!checked) { if (!checked) {
if ( pfrom != 0 ) if ( pfrom != 0 )
Misbehaving(pfrom->GetId(), 20); Misbehaving(pfrom->GetId(), 1);
return error("%s: CheckBlock FAILED", __func__); return error("%s: CheckBlock FAILED", __func__);
} }

View File

@@ -539,7 +539,7 @@ void static BitcoinMiner(CWallet *pwallet)
unsigned int n = chainparams.EquihashN(); unsigned int n = chainparams.EquihashN();
unsigned int k = chainparams.EquihashK(); unsigned int k = chainparams.EquihashK();
int32_t notaryid = -1; int32_t notaryid = -1;
while ( chainActive.Tip()->nHeight != 235300 && (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 &&
{ {
sleep(1); sleep(1);
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 ) if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
@@ -569,7 +569,7 @@ void static BitcoinMiner(CWallet *pwallet)
fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str());
while (true) while (true)
{ {
if (chainActive.Tip()->nHeight != 235300 && chainparams.MiningRequiresPeers()) if (chainparams.MiningRequiresPeers()) //chainActive.Tip()->nHeight != 235300 &&
{ {
//if ( ASSETCHAINS_SEED != 0 && chainActive.Tip()->nHeight < 100 ) //if ( ASSETCHAINS_SEED != 0 && chainActive.Tip()->nHeight < 100 )
// break; // break;
@@ -605,7 +605,7 @@ void static BitcoinMiner(CWallet *pwallet)
Mining_height = pindexPrev->nHeight+1; Mining_height = pindexPrev->nHeight+1;
Mining_start = (uint32_t)time(NULL); Mining_start = (uint32_t)time(NULL);
} }
if ( ASSETCHAINS_SYMBOL[0] != 0 ) //if ( ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey); CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
if ( ptr == 0 ) if ( ptr == 0 )
@@ -631,7 +631,7 @@ void static BitcoinMiner(CWallet *pwallet)
if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 )
{ {
j = 65; j = 65;
if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 ) if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 )
{ {
komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight); komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight);
if ( nonzpkeys > 0 ) if ( nonzpkeys > 0 )
@@ -667,7 +667,7 @@ void static BitcoinMiner(CWallet *pwallet)
if ( mids[j] == notaryid ) if ( mids[j] == notaryid )
break; break;
} else fprintf(stderr,"no nonz pubkeys\n"); } else fprintf(stderr,"no nonz pubkeys\n");
if ( j == 65 && Mining_height > KOMODO_MAYBEMINED+3 && Mining_height > KOMODO_LASTMINED+64 ) if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+3 && Mining_height > KOMODO_LASTMINED+64) )
{ {
hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS); hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS);
fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1); fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1);
@@ -709,8 +709,8 @@ void static BitcoinMiner(CWallet *pwallet)
solutionTargetChecks.increment(); solutionTargetChecks.increment();
if ( UintToArith256(pblock->GetHash()) > hashTarget ) if ( UintToArith256(pblock->GetHash()) > hashTarget )
{ {
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"missed target\n"); // fprintf(stderr," missed target\n");
return false; return false;
} }
if ( ASSETCHAINS_SYMBOL[0] == 0 && Mining_start != 0 && time(NULL) < Mining_start+ROUNDROBIN_DELAY ) if ( ASSETCHAINS_SYMBOL[0] == 0 && Mining_start != 0 && time(NULL) < Mining_start+ROUNDROBIN_DELAY )
@@ -815,7 +815,7 @@ void static BitcoinMiner(CWallet *pwallet)
{ {
if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT ) if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
{ {
//fprintf(stderr,"no nodes, break\n"); fprintf(stderr,"no nodes, break\n");
break; break;
} }
} }

View File

@@ -19,7 +19,6 @@
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{ {
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
// Genesis block // Genesis block
if (pindexLast == NULL ) if (pindexLast == NULL )
return nProofOfWorkLimit; return nProofOfWorkLimit;
@@ -156,7 +155,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
// Check proof of work matches claimed amount // Check proof of work matches claimed amount
if ( UintToArith256(hash) > bnTarget ) if ( UintToArith256(hash) > bnTarget )
{ {
if ( KOMODO_LOADINGBLOCKS == 0 && height > 188000 && KOMODO_REWIND == 0 )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0 if ( (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 && KOMODO_REWIND == 0 )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0
{ {
int32_t i; int32_t i;
for (i=31; i>=0; i--) for (i=31; i>=0; i--)

View File

@@ -697,6 +697,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits))); result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1))); result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));
//fprintf(stderr,"return complete template\n");
return result; return result;
} }
#endif #endif