Merge branch 'dev' into jl777

This commit is contained in:
jl777
2018-04-20 09:32:24 +03:00
11 changed files with 41 additions and 48 deletions

View File

@@ -121,7 +121,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
MoMdepth = 0;
}
//if ( matched != 0 ) global independent states -> inside *sp
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height,MoM,MoMdepth);
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height);//,MoM,MoMdepth);
}
else if ( func == 'U' ) // deprecated
{
@@ -266,7 +266,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
memset(&MoM,0,sizeof(MoM));
MoMdepth = 0;
}
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height,MoM,MoMdepth);
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height);//,MoM,MoMdepth);
}
else if ( func == 'U' ) // deprecated
{
@@ -482,9 +482,10 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
//printf("ht.%d func N ht.%d errs.%d\n",height,NOTARIZED_HEIGHT,errs);
if ( sp != 0 )
{
if ( sp->MoMdepth > 0 && sp->MoM != zero )
fputc('M',fp);
else fputc('N',fp);
//if ( sp->MoMdepth > 0 && sp->MoM != zero )
// fputc('M',fp);
//else
fputc('N',fp);
if ( fwrite(&height,1,sizeof(height),fp) != sizeof(height) )
errs++;
if ( fwrite(&sp->NOTARIZED_HEIGHT,1,sizeof(sp->NOTARIZED_HEIGHT),fp) != sizeof(sp->NOTARIZED_HEIGHT) )
@@ -493,14 +494,14 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
errs++;
if ( fwrite(&sp->NOTARIZED_DESTTXID,1,sizeof(sp->NOTARIZED_DESTTXID),fp) != sizeof(sp->NOTARIZED_DESTTXID) )
errs++;
if ( sp->MoMdepth > 0 && sp->MoM != zero )
/*if ( sp->MoMdepth > 0 && sp->MoM != zero )
{
if ( fwrite(&sp->MoM,1,sizeof(sp->MoM),fp) != sizeof(sp->MoM) )
errs++;
if ( fwrite(&sp->MoMdepth,1,sizeof(sp->MoMdepth),fp) != sizeof(sp->MoMdepth) )
errs++;
}
komodo_eventadd_notarized(sp,symbol,height,dest,sp->NOTARIZED_HASH,sp->NOTARIZED_DESTTXID,sp->NOTARIZED_HEIGHT,sp->MoM,sp->MoMdepth);
}*/
komodo_eventadd_notarized(sp,symbol,height,dest,sp->NOTARIZED_HASH,sp->NOTARIZED_DESTTXID,sp->NOTARIZED_HEIGHT);//,sp->MoM,sp->MoMdepth);
}
}
fflush(fp);

View File

@@ -887,8 +887,6 @@ int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],uint32_t bloc
}
if ( blocktime != 0 && blocktimes[1] != 0 && blocktime < blocktimes[1]+57 )
{
//if ( height > 790000 )
// fprintf(stderr,"lag.%d ht.%d n.%d blocktimes[%u vs %u %u]\n",blocktime-blocktimes[1],height,notaryid,blocktime,blocktimes[0],blocktimes[1]);
if ( height > 807000 )
return(-2);
}

View File

@@ -37,7 +37,7 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char
return(ep);
}
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight,uint256 MoM,int32_t MoMdepth)
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight)//,uint256 MoM,int32_t MoMdepth)
{
struct komodo_event_notarized N;
if ( NOTARY_PUBKEY33[0] != 0 && komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 )
@@ -53,12 +53,12 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
N.blockhash = notarized_hash;
N.desttxid = notarized_desttxid;
N.notarizedheight = notarizedheight;
N.MoM = MoM;
N.MoMdepth = MoMdepth;
//N.MoM = MoM;
//N.MoMdepth = MoMdepth;
strncpy(N.dest,dest,sizeof(N.dest)-1);
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N));
if ( sp != 0 )
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid,MoM,MoMdepth);
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid);//,MoM,MoMdepth);
}
}

View File

@@ -23,7 +23,6 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port);
void komodo_init(int32_t height);
void komodo_assetchain_pubkeys(char *jsonstr);
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
int32_t komodo_isrealtime(int32_t *kmdheightp);
uint64_t komodo_paxtotal();

View File

@@ -13,6 +13,7 @@
* *
******************************************************************************/
#include "komodo_defs.h"
#include "komodo_cJSON.h"
@@ -436,7 +437,6 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
return(0);
}
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp)
{
struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
@@ -493,7 +493,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n
return(0);
}
void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth)
void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid)//,uint256 MoM,int32_t MoMdepth)
{
struct notarized_checkpoint *np;
if ( notarized_height >= nHeight )
@@ -511,8 +511,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not
sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height;
sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash;
sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid;
sp->MoM = np->MoM = MoM;
sp->MoMdepth = np->MoMdepth = MoMdepth;
//sp->MoM = np->MoM = MoM;
//sp->MoMdepth = np->MoMdepth = MoMdepth;
portable_mutex_unlock(&komodo_mutex);
}

View File

@@ -4244,7 +4244,6 @@ void FindFilesToPrune(std::set<int>& setFilesToPrune)
if (chainActive.Tip()->nHeight <= Params().PruneAfterHeight()) {
return;
}
unsigned int nLastBlockWeCanPrune = chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP;
uint64_t nCurrentUsage = CalculateCurrentUsage();
// We don't check to prune until after we've allocated new space for files

View File

@@ -135,7 +135,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "paxpending", 0 },
{ "notaries", 2 },
{ "height_MoM", 1 },
//{ "MoMoMdata", 3 },
{ "MoMoMdata", 3 },
{ "allMoMs", 2 },
{ "txMoMproof", 1 },
{ "minerids", 1 },