This commit is contained in:
jl777
2016-12-03 11:28:36 -03:00
parent d3b5faf9a6
commit c023699ab5
3 changed files with 15 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ struct komodo_state KOMODO_STATES[34];
int COINBASE_MATURITY = 100;
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE;
int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES;
uint8_t NOTARY_PUBKEY33[33];

View File

@@ -1450,6 +1450,8 @@ void komodo_args()
if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
USE_EXTERNAL_PUBKEY = 1;
name = GetArg("-ac_name","");
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
printf("KOMODO REWIND.%d\n",KOMODO_REWIND);
if ( name.c_str()[0] != 0 )
{
ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10);

View File

@@ -2694,6 +2694,7 @@ static void PruneBlockIndexCandidates() {
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
*/
static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) {
extern int32_t KOMODO_REWIND;
AssertLockHeld(cs_main);
bool fInvalidFound = false;
const CBlockIndex *pindexOldTip = chainActive.Tip();
@@ -2704,21 +2705,21 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
if (!DisconnectTip(state))
return false;
}
if ( 1 )
{
static int32_t didinit;
if ( didinit++ == 0 )
if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight > KOMODO_REWIND )
{
while (chainActive.Tip()->nHeight > 94000 )
static int32_t didinit;
if ( didinit++ == 0 )
{
fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight);
if ( !DisconnectTip(state) )
return false;
while (chainActive.Tip()->nHeight > KOMODO_REWIND )
{
fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight);
if ( !DisconnectTip(state) )
return false;
}
pindexOldTip = chainActive.Tip();
pindexFork = chainActive.FindFork(pindexMostWork);
}
pindexOldTip = chainActive.Tip();
pindexFork = chainActive.FindFork(pindexMostWork);
}
}
// Build list of new blocks to connect.
std::vector<CBlockIndex*> vpindexToConnect;
bool fContinue = true;