This commit is contained in:
blackjok3r
2019-01-10 02:25:59 +08:00
27 changed files with 226 additions and 801 deletions

View File

@@ -82,7 +82,7 @@ extern uint8_t NOTARY_PUBKEY33[33];
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_INSYNC,KOMODO_CONNECTING,KOMODO_EXTRASATOSHI;
int32_t KOMODO_NEWBLOCKS;
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
void komodo_broadcast(CBlock *pblock,int32_t limit);
//void komodo_broadcast(CBlock *pblock,int32_t limit);
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
void komodo_setactivation(int32_t height);
@@ -1092,6 +1092,7 @@ bool ContextualCheckTransaction(
}
// Rules that apply to Overwinter or later:
//fprintf(stderr,"ht.%d overwinterActive.%d tx.overwintered.%d\n",nHeight,overwinterActive,overwinterActive);
if (overwinterActive)
{
// Reject transactions intended for Sprout
@@ -3197,7 +3198,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
//fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock);
return false;
}
if ( fCheckPOW != 0 && !ContextualCheckBlock(block, state, pindex->pprev) ) // Activate Jan 15th, 2019
{
fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight());
if ( pindex->nTime > 1547510400 )
return false;
fprintf(stderr,"grandfathered exception, until jan 15th 2019\n");
}
// verify that the view's current state corresponds to the previous block
uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash();
if ( hashPrevBlock != view.GetBestBlock() )
@@ -4010,10 +4017,10 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
else KOMODO_INSYNC = 0;
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
komodo_broadcast(pblock,8);
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
komodo_broadcast(pblock,4);
komodo_broadcast(pblock,4);*/
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
komodo_activate_sapling(pindexNew);
return true;
@@ -4104,7 +4111,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
// then pindexFork will be null, and we would need to remove the entire chain including
// our genesis block. In practice this (probably) won't happen because of checks elsewhere.
auto reorgLength = pindexOldTip ? pindexOldTip->GetHeight() - (pindexFork ? pindexFork->GetHeight() : -1) : 0;
static_assert(MAX_REORG_LENGTH > 0, "We must be able to reorg some distance");
assert(MAX_REORG_LENGTH > 0);//, "We must be able to reorg some distance");
if (reorgLength > MAX_REORG_LENGTH)
{
int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;
@@ -4130,7 +4137,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
"- " + strprintf(_("Fork point: %s %s, height %d"),
ASSETCHAINS_SYMBOL,pindexFork->phashBlock->GetHex(), pindexFork->GetHeight()) + "\n\n" +
_("Please help, human!");
LogPrintf("*** %s\n", msg);
LogPrintf("*** %s\nif you launch with -maxreorg=%d it might be able to resolve this automatically", msg,reorgLength+10);
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return false;
@@ -5095,8 +5102,8 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
// the problem is when a future sapling block comes in before we detected saplinght
if ( saplinght > 0 && (tmpptr= chainActive.LastTip()) != 0 )
{
fprintf(stderr,"saplinght.%d tipht.%d blockht.%d cmp.%d\n",saplinght,(int32_t)tmpptr->GetHeight(),pindex->GetHeight(),pindex->GetHeight() < 0 || pindex->GetHeight() >= saplinght || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720));
if ( pindex->GetHeight() < 0 || pindex->GetHeight() >= saplinght || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720) )
fprintf(stderr,"saplinght.%d tipht.%d blockht.%d cmp.%d\n",saplinght,(int32_t)tmpptr->GetHeight(),pindex->GetHeight(),pindex->GetHeight() < 0 || (pindex->GetHeight() >= saplinght && pindex->GetHeight() < saplinght+50000) || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720));
if ( pindex->GetHeight() < 0 || (pindex->GetHeight() >= saplinght && pindex->GetHeight() < saplinght+50000) || (tmpptr->GetHeight() > saplinght-720 && tmpptr->GetHeight() < saplinght+720) )
*futureblockp = 1;
}
if ( *futureblockp == 0 )