Test edge detection

This commit is contained in:
jl777
2018-11-22 00:46:28 -11:00
parent 4556f3da4a
commit 727bba40c9
2 changed files with 8 additions and 4 deletions

View File

@@ -217,6 +217,7 @@ void komodo_setactivation(int32_t height)
{ {
mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = height; mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = height;
mainParams.consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = height; mainParams.consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = height;
ASSETCHAINS_SAPLING = activation;
} }
void *chainparams_commandline(void *ptr) void *chainparams_commandline(void *ptr)

View File

@@ -3780,7 +3780,10 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
{ {
uint32_t blocktime,prevtime; CBlockIndex *prev; int32_t i,transition=0,height,prevht,activation = 0; uint32_t blocktime,prevtime; CBlockIndex *prev; int32_t i,transition=0,height,prevht,activation = 0;
if ( pindex == 0 ) if ( pindex == 0 )
{
fprintf(stderr,"komodo_activate_sapling null pindex\n");
return(0); return(0);
}
for (i=0; i<60; i++) for (i=0; i<60; i++)
{ {
if ( (prev= pindex->pprev) == 0 ) if ( (prev= pindex->pprev) == 0 )
@@ -3794,12 +3797,14 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
} }
height = pindex->GetHeight(); height = pindex->GetHeight();
blocktime = (uint32_t)pindex->nTime; blocktime = (uint32_t)pindex->nTime;
fprintf(stderr,"starting blocktime %u cmp.%d\n",blocktime,blocktime > KOMODO_SAPLING_ACTIVATION);
if ( blocktime > KOMODO_SAPLING_ACTIVATION ) // find the earliest transition if ( blocktime > KOMODO_SAPLING_ACTIVATION ) // find the earliest transition
{ {
while ( (prev= pindex->pprev) != 0 ) while ( (prev= pindex->pprev) != 0 )
{ {
prevht = prev->GetHeight(); prevht = prev->GetHeight();
prevtime = (uint32_t)prev->nTime; prevtime = (uint32_t)prev->nTime;
fprintf(stderr,"(%d, %u) -> (%d, %u)\n",prevht,prevtime,height,blocktime);
if ( prevht+1 != height ) if ( prevht+1 != height )
{ {
fprintf(stderr,"komodo_activate_sapling: unexpected non-contiguous ht %d vs %d\n",prevht,height); fprintf(stderr,"komodo_activate_sapling: unexpected non-contiguous ht %d vs %d\n",prevht,height);
@@ -3816,6 +3821,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
height = prevht; height = prevht;
blocktime = prevtime; blocktime = prevtime;
} }
fprintf(stderr,"ht.%d %u, transition.%d\n",height,blocktime,transition);
if ( transition != 0 ) if ( transition != 0 )
{ {
activation = transition + 60; activation = transition + 60;
@@ -3824,10 +3830,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
} }
if ( activation != 0 ) if ( activation != 0 )
{ {
komodo_setactivation(activation); //komodo_setactivation(activation);
//Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = activation;
//Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = activation;
ASSETCHAINS_SAPLING = activation;
fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation); fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation);
} }
} }