komodo_reconsiderblock

This commit is contained in:
jl777
2019-04-12 01:56:16 -11:00
parent b306b39550
commit 7ad01e44ed
3 changed files with 24 additions and 2 deletions

View File

@@ -448,6 +448,18 @@ int32_t komodo_verifynotarizedscript(int32_t height,uint8_t *script,int32_t len,
return(-1);
}
void komodo_reconsiderblock(uint256 blockhash)
{
char params[256],*jsonstr,*hexstr;
sprintf(params,"[\"%s\"]",blockhash.ToString().c_str());
komodo_reconsiderblock(Queued_reconsiderblock);
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"reconsiderblock",params,KMD_PORT)) != 0 )
{
fprintf(stderr,"komodo_reconsiderblock.(%s) -> (%s)\n",params,jsonstr);
free(jsonstr);
}
}
int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t NOTARIZED_HEIGHT,uint256 NOTARIZED_HASH,uint256 NOTARIZED_DESTTXID)
{
char params[256],*jsonstr,*hexstr; uint8_t *script,_script[8192]; int32_t n,len,retval = -1; cJSON *json,*txjson,*vouts,*vout,*skey;

View File

@@ -2625,10 +2625,17 @@ void komodo_pricesinit()
}
}
extern Queued_reconsiderblock;
void komodo_pricesupdate(int32_t height,CBlock *pblock)
{
static int numprices; static uint32_t *ptr32; static int64_t *ptr64,*tmpbuf;
int32_t ind,offset,width; int64_t correlated,smoothed; uint64_t seed,rngval; uint32_t rawprices[KOMODO_MAXPRICES],buf[PRICES_MAXDATAPOINTS*2];
if ( Queued_reconsiderblock != zeroid )
{
komodo_reconsiderblock(Queued_reconsiderblock);
Queued_reconsiderblock = zeroid;
}
width = PRICES_DAYWINDOW;//(2*PRICES_DAYWINDOW + PRICES_SMOOTHWIDTH);
if ( numprices == 0 )
{

View File

@@ -5273,6 +5273,8 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
return true;
}
uint256 Queued_reconsiderblock;
bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp)
{
const CChainParams& chainparams = Params();
@@ -5336,12 +5338,13 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
if ( ASSETCHAINS_CBOPRET != 0 )
{
CValidationState tmpstate; CBlockIndex *tmpindex; int32_t ht,longest;
ht = (int32_t)pindex->GetHeight()-1;
ht = (int32_t)pindex->GetHeight();
longest = komodo_longestchain();
if ( (longest == 0 || ht < longest-6) && (tmpindex=komodo_chainactive(ht)) != 0 )
{
fprintf(stderr,"reconsider height.%d, longest.%d\n",(int32_t)ht,longest);
InvalidateBlock(tmpstate,tmpindex);
if ( Queued_reconsiderblock == zeroid )
Queued_reconsiderblock = pindex->GetHash();
}
}
}