Prune asset chain processing

This commit is contained in:
jl777
2017-03-18 16:09:05 +02:00
parent d071a68305
commit b2e010eef6

View File

@@ -839,7 +839,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
bitcoin_address(coinaddr,addrtype,rmd160,20); bitcoin_address(coinaddr,addrtype,rmd160,20);
checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis); checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis);
typestr = "deposit"; typestr = "deposit";
if ( kmdheight > 195000 || kmdheight <= height ) if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 && (kmdheight > 195000 || kmdheight <= height) )
{ {
didstats = 0; didstats = 0;
if ( 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) if ( 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
@@ -915,7 +915,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
else if ( opretbuf[0] == 'I' ) else if ( opretbuf[0] == 'I' )
{ {
tokomodo = 0; tokomodo = 0;
if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 ) if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4],3)) == 0 )
{ {
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 )
{ {
@@ -961,7 +961,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("opreturn none issued?\n"); } //else printf("opreturn none issued?\n");
} }
} }
else if ( height < 236000 && opretbuf[0] == 'W' )//&& opretlen >= 38 ) else if ( height < 236000 && opretbuf[0] == 'W' && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )//&& opretlen >= 38 )
{ {
if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 ) if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )
{ {
@@ -1006,7 +1006,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis)); } // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis));
// need to allocate pax // need to allocate pax
} }
else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' ) else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' && ASSETCHAINS_SYMBOL[0] == 0 )
{ {
tokomodo = 1; tokomodo = 1;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
@@ -1085,7 +1085,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("n.%d from opreturns\n",n); } //else printf("n.%d from opreturns\n",n);
//printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal())); //printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal()));
} }
else if ( height < 236000 && opretbuf[0] == 'X' ) else if ( height < 236000 && opretbuf[0] == 'X' && ASSETCHAINS_SYMBOL[0] == 0 )
{ {
tokomodo = 1; tokomodo = 1;
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 ) if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 )
@@ -1127,7 +1127,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
void komodo_passport_iteration() void komodo_passport_iteration()
{ {
static long lastpos[34]; static char userpass[33][1024]; int32_t maxseconds = 1; static long lastpos[34]; static char userpass[33][1024]; int32_t maxseconds = 10;
FILE *fp; int32_t baseid,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; FILE *fp; int32_t baseid,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
//printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL); //printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL);
expired = 0; expired = 0;
@@ -1156,13 +1156,15 @@ void komodo_passport_iteration()
starttime = (uint32_t)time(NULL); starttime = (uint32_t)time(NULL);
//printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid); //printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid);
for (baseid=32; baseid>=0; baseid--) for (baseid=32; baseid>=0; baseid--)
{break; {
if ( time(NULL) >= starttime+maxseconds ) if ( time(NULL) >= starttime+maxseconds )
break; break;
sp = 0; sp = 0;
isrealtime = 0; isrealtime = 0;
base = (char *)CURRENCIES[baseid]; base = (char *)CURRENCIES[baseid];
if ( baseid+1 != refid ) if ( baseid+1 != refid )
{
if ( baseid == 32 )
{ {
komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"komodostate"); komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"komodostate");
komodo_nameset(symbol,dest,base); komodo_nameset(symbol,dest,base);
@@ -1213,6 +1215,7 @@ void komodo_passport_iteration()
fclose(fp); fclose(fp);
} //else fprintf(stderr,"%s open error RT\n",base); } //else fprintf(stderr,"%s open error RT\n",base);
} }
}
else else
{ {
komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"realtime"); komodo_statefname(fname,baseid<32?base:(char *)"",(char *)"realtime");