Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #247

Merged
merged 22 commits into from
Mar 13, 2017
Merged
2 changes: 1 addition & 1 deletion src/komodo_gateway.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ void komodo_bannedset(uint256 *array,int32_t max)
array[i] = uint256S(banned_txids[i]);
if ( 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
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ bool IsInitialBlockDownload()
}
bool state;
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());
else state = (chainActive.Height() < pindexBestHeader->nHeight - 100);
if (!state)
Expand Down Expand Up @@ -3206,7 +3206,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
int nHeight = pindexPrev->nHeight+1;

// 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;
return state.DoS(100, error("%s: incorrect proof of work", __func__),
Expand Down Expand Up @@ -3413,7 +3413,7 @@ bool ProcessNewBlock(int32_t height,CValidationState &state, CNode* pfrom, CBloc
fRequested |= fForceProcessing;
if (!checked) {
if ( pfrom != 0 )
Misbehaving(pfrom->GetId(), 20);
Misbehaving(pfrom->GetId(), 1);
return error("%s: CheckBlock FAILED", __func__);
}

Expand Down
16 changes: 8 additions & 8 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void static BitcoinMiner(CWallet *pwallet)
unsigned int n = chainparams.EquihashN();
unsigned int k = chainparams.EquihashK();
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);
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
Expand Down Expand Up @@ -569,7 +569,7 @@ void static BitcoinMiner(CWallet *pwallet)
fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str());
while (true)
{
if (chainActive.Tip()->nHeight != 235300 && chainparams.MiningRequiresPeers())
if (chainparams.MiningRequiresPeers()) //chainActive.Tip()->nHeight != 235300 &&
{
//if ( ASSETCHAINS_SEED != 0 && chainActive.Tip()->nHeight < 100 )
// break;
Expand Down Expand Up @@ -605,7 +605,7 @@ void static BitcoinMiner(CWallet *pwallet)
Mining_height = pindexPrev->nHeight+1;
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);
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
if ( ptr == 0 )
Expand All @@ -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 )
{
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);
if ( nonzpkeys > 0 )
Expand Down Expand Up @@ -667,7 +667,7 @@ void static BitcoinMiner(CWallet *pwallet)
if ( mids[j] == notaryid )
break;
} 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);
fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1);
Expand Down Expand Up @@ -709,8 +709,8 @@ void static BitcoinMiner(CWallet *pwallet)
solutionTargetChecks.increment();
if ( UintToArith256(pblock->GetHash()) > hashTarget )
{
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"missed target\n");
//if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
// fprintf(stderr," missed target\n");
return false;
}
if ( ASSETCHAINS_SYMBOL[0] == 0 && Mining_start != 0 && time(NULL) < Mining_start+ROUNDROBIN_DELAY )
Expand Down Expand Up @@ -815,7 +815,7 @@ void static BitcoinMiner(CWallet *pwallet)
{
if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
{
//fprintf(stderr,"no nodes, break\n");
fprintf(stderr,"no nodes, break\n");
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();

// Genesis block
if (pindexLast == NULL )
return nProofOfWorkLimit;
Expand Down Expand Up @@ -156,7 +155,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
// Check proof of work matches claimed amount
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;
for (i=31; i>=0; i--)
Expand Down
1 change: 1 addition & 0 deletions src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));

//fprintf(stderr,"return complete template\n");
return result;
}
#endif
Expand Down