From ee5e8026aec4af0e6ed3acc43c239230a1d82685 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 11:39:58 +0300 Subject: [PATCH 01/23] Allow asset chains notarization.11 --- src/komodo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 23ccb6338..2687e2add 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -545,7 +545,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); - if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/5)) ) + if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || + (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || + numvalid > (numnotaries/5)) ) { if ( height > 500000 ) printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); From a0b9382cb9bccf94aec0a72658406d43ade9c885 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:10:22 +0300 Subject: [PATCH 02/23] Test --- src/komodo.h | 4 ++-- src/komodo_bitcoind.h | 12 ++++++++---- src/komodo_notary.h | 32 +++++++++++++++++++++++++++----- src/komodo_structs.h | 2 +- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 2687e2add..0395f3d65 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -549,8 +549,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( height > 500000 ) - printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + if ( height > 500000 || ASSETCHAINS_SYMBOL[0] != 0 ) + printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); notarized = 1; } if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5be8da5e2..e040a4a09 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -427,15 +427,18 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str()); if ( strcmp(symbol,ASSETCHAINS_SYMBOL[0]==0?(char *)"KMD":ASSETCHAINS_SYMBOL) != 0 ) return(0); - //printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT); if ( strcmp(dest,"KMD") == 0 ) { if ( KMDUSERPASS[0] != 0 ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771); - } - //else jsonstr = _dex_getrawtransaction(); +printf("got (%s)\n",jsonstr); + } + }//else jsonstr = _dex_getrawtransaction(); else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok } else if ( strcmp(dest,"BTC") == 0 ) @@ -460,7 +463,8 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( (txjson= jobj(json,(char *)"result")) != 0 && (vouts= jarray(&n,txjson,(char *)"vout")) > 0 ) { vout = jitem(vouts,n-1); - //printf("vout.(%s)\n",jprint(vout,0)); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("vout.(%s)\n",jprint(vout,0)); if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 ) { if ( (hexstr= jstr(skey,(char *)"hex")) != 0 ) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e47638c8e..28ea470c0 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -320,26 +320,48 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp) int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) { - struct notarized_checkpoint *np = 0; int32_t i; char symbol[16],dest[16]; struct komodo_state *sp; + struct notarized_checkpoint *np = 0; int32_t i,flag = 0; char symbol[16],dest[16]; struct komodo_state *sp; if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) { if ( sp->NUM_NPOINTS > 0 ) { - for (i=0; iNUM_NPOINTS; i++) + flag = 0; + if ( sp->last_NPOINTSi < sp->NUM_POINTS && sp->last_NPOINTSi > 0 ) { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - break; - np = &sp->NPOINTS[i]; + np = &sp->NPOINTS[sp->last_NPOINTSi-1]; + for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + flag = 1; + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + if ( flag == 0 ) + { + np = 0; + for (i=0; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + break; + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } } } if ( np != 0 ) { + char str[65],str2[65]; printf("[%s] notarized_ht.%d %s -> %s\n",ASSETCHAINS_SYMBOL,np->notarized_height,bits256_str(str,np->notarized_hash),bits256_str(str2,np->notarized_desttxid)); *notarized_hashp = np->notarized_hash; *notarized_desttxidp = np->notarized_desttxid; return(np->notarized_height); } } memset(notarized_hashp,0,sizeof(*notarized_hashp)); + memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); return(0); } diff --git a/src/komodo_structs.h b/src/komodo_structs.h index 510a7e488..8db0a6f43 100644 --- a/src/komodo_structs.h +++ b/src/komodo_structs.h @@ -84,7 +84,7 @@ struct komodo_state int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT; uint32_t SAVEDTIMESTAMP; uint64_t deposited,issued,withdrawn,approved,redeemed,shorted; - struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS; + struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS,last_NPOINTSi; struct komodo_event **Komodo_events; int32_t Komodo_numevents; uint32_t RTbufs[64][3]; uint64_t RTmask; }; From f480802b461b65b5de14bf39a6c9df2c37df5d43 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:11:58 +0300 Subject: [PATCH 03/23] Test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 28ea470c0..abb878921 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -354,7 +354,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n } if ( np != 0 ) { - char str[65],str2[65]; printf("[%s] notarized_ht.%d %s -> %s\n",ASSETCHAINS_SYMBOL,np->notarized_height,bits256_str(str,np->notarized_hash),bits256_str(str2,np->notarized_desttxid)); + char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); *notarized_hashp = np->notarized_hash; *notarized_desttxidp = np->notarized_desttxid; return(np->notarized_height); From 7df54c32755b17f73fd37ef4db584a47a3f9b411 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:14:21 +0300 Subject: [PATCH 04/23] Test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index abb878921..80de01629 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -326,7 +326,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n if ( sp->NUM_NPOINTS > 0 ) { flag = 0; - if ( sp->last_NPOINTSi < sp->NUM_POINTS && sp->last_NPOINTSi > 0 ) + if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) { np = &sp->NPOINTS[sp->last_NPOINTSi-1]; for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) From a4f48f007952ce975ddb0a846b01f61f279d24e5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:21:44 +0300 Subject: [PATCH 05/23] Test --- src/komodo.h | 2 +- src/komodo_events.h | 5 +++-- src/komodo_notary.h | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 0395f3d65..83f7eb446 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -103,7 +103,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char errs++; if ( fread(¬arized_desttxid,1,sizeof(notarized_desttxid),fp) != sizeof(notarized_desttxid) ) errs++; - if ( 0 && sp != 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 ) printf("%s load[%s.%d] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,notarized_height,notarized_hash.ToString().c_str()); //if ( matched != 0 ) global independent states -> inside *sp komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height); diff --git a/src/komodo_events.h b/src/komodo_events.h index 0ee3aa1f3..886854fd6 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -41,12 +41,13 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig struct komodo_event_notarized N; if ( komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 ) { - if ( height > 50000 ) + if ( height > 50000 || ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest); } else { - //fprintf(stderr,"validated %s ht.%d notarized %d\n",ASSETCHAINS_SYMBOL,height,notarizedheight); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"validated [%s] ht.%d notarized %d\n",ASSETCHAINS_SYMBOL,height,notarizedheight); memset(&N,0,sizeof(N)); N.blockhash = notarized_hash; N.desttxid = notarized_desttxid; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 80de01629..73100a7df 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -289,6 +289,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not printf("komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); return; } + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); portable_mutex_lock(&komodo_mutex); sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); np = &sp->NPOINTS[sp->NUM_NPOINTS++]; From fac8d1ff97e40860fc27b9f2ac9b57ed2e60407f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:36:34 +0300 Subject: [PATCH 06/23] Test --- src/komodo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 83f7eb446..d2d330f20 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -80,7 +80,8 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char else matched = (strcmp(symbol,ASSETCHAINS_SYMBOL) == 0); if ( fread(&ht,1,sizeof(ht),fp) != sizeof(ht) ) errs++; - //printf("fpos.%ld func.(%d %c) ht.%d ",ftell(fp),func,func,ht); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("matched.%d fpos.%ld func.(%d %c) ht.%d ",matched,ftell(fp),func,func,ht); if ( func == 'P' ) { if ( (num= fgetc(fp)) <= 64 ) @@ -204,6 +205,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar if ( (sp= komodo_stateptr(symbol,dest)) == 0 ) { KOMODO_INITDONE = (uint32_t)time(NULL); + printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL); return; } if ( fp == 0 ) From 5d3c01863135f2542ee653aa490b959abbe39b11 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:40:34 +0300 Subject: [PATCH 07/23] Test --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d2d330f20..ae26eb9f5 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -80,8 +80,8 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char else matched = (strcmp(symbol,ASSETCHAINS_SYMBOL) == 0); if ( fread(&ht,1,sizeof(ht),fp) != sizeof(ht) ) errs++; - if ( ASSETCHAINS_SYMBOL[0] != 0 ) - printf("matched.%d fpos.%ld func.(%d %c) ht.%d ",matched,ftell(fp),func,func,ht); + if ( ASSETCHAINS_SYMBOL[0] != 0 && func != 'T' ) + printf("matched.%d fpos.%ld func.(%d %c) ht.%d\n",matched,ftell(fp),func,func,ht); if ( func == 'P' ) { if ( (num= fgetc(fp)) <= 64 ) From 7c18529bef5545361edb1ec2616141b46e1597b1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:52:15 +0300 Subject: [PATCH 08/23] Test --- src/komodo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index ae26eb9f5..030775fa9 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -391,6 +391,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr opretlen = scriptbuf[len++]; opretlen += (scriptbuf[len++] << 8); } + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("notarized.%d notarizedht.%d sp.Nht %d sp.ht %d opretlen.%d (%c %d)\n",notarized,*notarizedheightp,sp->NOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4]); if ( j == 1 && opretlen >= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) { len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&kmdtxid); @@ -403,7 +405,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr sp->NOTARIZED_DESTTXID = desttxid; komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0); len += 4; - if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("%s ht.%d NOTARIZED.%d %s.%s %sTXID.%s (%s) lens.(%d %d)\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),(char *)&scriptbuf[len],opretlen,len); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { From 66134a2290bce9a32775e27c5a7223a295ad6878 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 12:53:51 +0300 Subject: [PATCH 09/23] Test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 030775fa9..7bbcd6f6c 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -392,7 +392,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr opretlen += (scriptbuf[len++] << 8); } if ( ASSETCHAINS_SYMBOL[0] != 0 ) - printf("notarized.%d notarizedht.%d sp.Nht %d sp.ht %d opretlen.%d (%c %d)\n",notarized,*notarizedheightp,sp->NOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4]); + printf("notarized.%d notarizedht.%d sp.Nht %d sp.ht %d opretlen.%d (%c %d)\n",notarized,*notarizedheightp,sp->NOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4],scriptbuf[len+32*2+4]); if ( j == 1 && opretlen >= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) { len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&kmdtxid); From 0b27cefac1aa475d0a5e5ff522f4c4ee9d09393a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:00:54 +0300 Subject: [PATCH 10/23] Test --- src/komodo.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 7bbcd6f6c..72bc026a0 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -392,7 +392,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr opretlen += (scriptbuf[len++] << 8); } if ( ASSETCHAINS_SYMBOL[0] != 0 ) - printf("notarized.%d notarizedht.%d sp.Nht %d sp.ht %d opretlen.%d (%c %d)\n",notarized,*notarizedheightp,sp->NOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4],scriptbuf[len+32*2+4]); + printf("[%s] notarized.%d notarizedht.%d sp.Nht %d sp.ht %d opretlen.%d (%c %c %c)\n",ASSETCHAINS_SYMBOL,notarized,*notarizedheightp,sp->NOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4],scriptbuf[len+32*2+4+1],scriptbuf[len+32*2+4+2]); if ( j == 1 && opretlen >= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) { len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&kmdtxid); @@ -596,7 +596,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) printf(") "); - //printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification); + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification); if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) ) { if ( isratification != 0 ) From d0d61f8f47ecd887376f9d7fa63015abf047b876 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:03:39 +0300 Subject: [PATCH 11/23] Test --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 72bc026a0..f94a54b57 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -81,7 +81,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char if ( fread(&ht,1,sizeof(ht),fp) != sizeof(ht) ) errs++; if ( ASSETCHAINS_SYMBOL[0] != 0 && func != 'T' ) - printf("matched.%d fpos.%ld func.(%d %c) ht.%d\n",matched,ftell(fp),func,func,ht); + printf("[%s] matched.%d fpos.%ld func.(%d %c) ht.%d\n",ASSETCHAINS_SYMBOL,matched,ftell(fp),func,func,ht); if ( func == 'P' ) { if ( (num= fgetc(fp)) <= 64 ) @@ -157,7 +157,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char { if ( fread(opret,1,olen,fp) != olen ) errs++; - if ( 0 && matched != 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) { int32_t i; for (i=0; i Date: Mon, 23 Oct 2017 13:15:57 +0300 Subject: [PATCH 12/23] Test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 73100a7df..d159c3d9f 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -170,7 +170,7 @@ int32_t komodo_ratify_threshold(int32_t height,uint64_t signedmask) int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height) { int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( height >= 180000 ) + if ( height >= 180000 || ASSETCHAINS_SYMBOL[0] != 0 ) { n = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); for (i=0; i Date: Mon, 23 Oct 2017 13:21:14 +0300 Subject: [PATCH 13/23] Test --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e040a4a09..d7a6e1d94 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -436,7 +436,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( ASSETCHAINS_SYMBOL[0] != 0 ) { jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771); -printf("got (%s)\n",jsonstr); +printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr); } }//else jsonstr = _dex_getrawtransaction(); else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok From 36c733e967f4e336ebfe598dbe91f918ed01bd12 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:27:15 +0300 Subject: [PATCH 14/23] Test --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d7a6e1d94..787e72ad7 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -23,7 +23,7 @@ #include #endif -#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr)) +//#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr)) struct MemoryStruct { char *memory; size_t size; }; struct return_string { char *ptr; size_t len; }; @@ -196,7 +196,7 @@ try_again: databuf = (char *)malloc(256 + strlen(command) + strlen(params)); sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); - //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); + printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); // } //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params); curl_easy_setopt(curl_handle,CURLOPT_POST,1L); @@ -339,7 +339,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port) { sprintf(url,(char *)"http://127.0.0.1:%u",port); sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params); - //printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS); + printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS); retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params); //retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0); } From 05e307ec9e9b8efefc9f1815e7f50580b85bfa51 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:40:00 +0300 Subject: [PATCH 15/23] Test --- src/komodo_bitcoind.h | 8 ++++---- src/komodo_globals.h | 2 +- src/komodo_utils.h | 23 +++++++++++++++-------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 787e72ad7..a48abae69 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -196,7 +196,7 @@ try_again: databuf = (char *)malloc(256 + strlen(command) + strlen(params)); sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); - printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); + //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); // } //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params); curl_easy_setopt(curl_handle,CURLOPT_POST,1L); @@ -339,7 +339,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port) { sprintf(url,(char *)"http://127.0.0.1:%u",port); sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params); - printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS); + //printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS); retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params); //retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0); } @@ -353,7 +353,7 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig *kmdnotarized_heightp = 0; if ( strcmp(dest,"KMD") == 0 ) { - port = 7771; + port = KMD_PORT; userpass = KMDUSERPASS; } else if ( strcmp(dest,"BTC") == 0 ) @@ -435,7 +435,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { - jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771); + jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,KMD_PORT); printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr); } }//else jsonstr = _dex_getrawtransaction(); diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 6d8d6c325..2976deb8e 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -52,7 +52,7 @@ uint32_t ASSETCHAINS_MAGIC = 2387029918; uint64_t ASSETCHAINS_SUPPLY = 10; uint32_t KOMODO_INITDONE; -char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t BITCOIND_PORT = 7771; +char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_PORT = 7771; uint64_t PENDING_KOMODO_TX; struct komodo_kv *KOMODO_KV; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index cc935a363..d2fda32c9 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1261,9 +1261,9 @@ void iguana_initQ(queue_t *Q,char *name) free(item); } -void komodo_userpass(char *username,char *password,FILE *fp) +uint16_t komodo_userpass(char *username,char *password,FILE *fp) { - char *rpcuser,*rpcpassword,*str,line[8192]; + char *rpcuser,*rpcpassword,*str,line[8192]; uint16_t port = 0; rpcuser = rpcpassword = 0; username[0] = password[0] = 0; while ( fgets(line,sizeof(line),fp) != 0 ) @@ -1275,6 +1275,11 @@ void komodo_userpass(char *username,char *password,FILE *fp) rpcuser = parse_conf_line(str,(char *)"rpcuser"); else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 ) rpcpassword = parse_conf_line(str,(char *)"rpcpassword"); + else if ( (str= strstr(line,(char *)"rpcport")) != 0 ) + { + port = atoi(parse_conf_line(str,(char *)"rpcport")); + printf("rpcport.%u in file\n",port); + } } if ( rpcuser != 0 && rpcpassword != 0 ) { @@ -1286,6 +1291,7 @@ void komodo_userpass(char *username,char *password,FILE *fp) free(rpcuser); if ( rpcpassword != 0 ) free(rpcpassword); + return(port); } void komodo_statefname(char *fname,char *symbol,char *str) @@ -1328,7 +1334,7 @@ void komodo_statefname(char *fname,char *symbol,char *str) void komodo_configfile(char *symbol,uint16_t port) { static char myusername[512],mypassword[8192]; - FILE *fp; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; + FILE *fp; uint16_t port; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; if ( symbol != 0 && port != 0 ) { r = (uint32_t)time(NULL); @@ -1386,16 +1392,17 @@ void komodo_configfile(char *symbol,uint16_t port) #endif if ( (fp= fopen(fname,"rb")) != 0 ) { - komodo_userpass(username,password,fp); + if ( (port= komodo_userpass(username,password,fp)) != 0 ) + KMD_PORT = port; sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); } else printf("couldnt open.(%s)\n",fname); } -int32_t komodo_userpass(char *userpass,char *symbol) +uint16_t komodo_userpass(char *userpass,char *symbol) { - FILE *fp; char fname[512],username[512],password[512],confname[16]; + FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[16]; userpass[0] = 0; if ( strcmp("KMD",symbol) == 0 ) { @@ -1409,12 +1416,12 @@ int32_t komodo_userpass(char *userpass,char *symbol) komodo_statefname(fname,symbol,confname); if ( (fp= fopen(fname,"rb")) != 0 ) { - komodo_userpass(username,password,fp); + port = komodo_userpass(username,password,fp); sprintf(userpass,"%s:%s",username,password); fclose(fp); return((int32_t)strlen(userpass)); } - return(-1); + return(port); } uint32_t komodo_assetmagic(char *symbol,uint64_t supply) From 9850ab03d4004400fdf621348e9f01b0e44f89de Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:42:02 +0300 Subject: [PATCH 16/23] Test --- src/komodo_utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d2fda32c9..fc099c248 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1334,7 +1334,7 @@ void komodo_statefname(char *fname,char *symbol,char *str) void komodo_configfile(char *symbol,uint16_t port) { static char myusername[512],mypassword[8192]; - FILE *fp; uint16_t port; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; + FILE *fp; uint16_t kmdport; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; if ( symbol != 0 && port != 0 ) { r = (uint32_t)time(NULL); @@ -1392,8 +1392,8 @@ void komodo_configfile(char *symbol,uint16_t port) #endif if ( (fp= fopen(fname,"rb")) != 0 ) { - if ( (port= komodo_userpass(username,password,fp)) != 0 ) - KMD_PORT = port; + if ( (kmdport= komodo_userpass(username,password,fp)) != 0 ) + KMD_PORT = kmdport; sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); From 21abd4df815cab904da29ffaf2b3b550dd9ddc99 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:45:05 +0300 Subject: [PATCH 17/23] Test --- src/komodo_bitcoind.h | 2 +- src/komodo_utils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a48abae69..390d84736 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -436,7 +436,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( ASSETCHAINS_SYMBOL[0] != 0 ) { jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,KMD_PORT); -printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr); +//printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr); } }//else jsonstr = _dex_getrawtransaction(); else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok diff --git a/src/komodo_utils.h b/src/komodo_utils.h index fc099c248..92577dae0 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1278,7 +1278,7 @@ uint16_t komodo_userpass(char *username,char *password,FILE *fp) else if ( (str= strstr(line,(char *)"rpcport")) != 0 ) { port = atoi(parse_conf_line(str,(char *)"rpcport")); - printf("rpcport.%u in file\n",port); + //printf("rpcport.%u in file\n",port); } } if ( rpcuser != 0 && rpcpassword != 0 ) From 34c68daaa911a6d5f177bc1a3b1a80a5debfcbe5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:49:19 +0300 Subject: [PATCH 18/23] Test --- src/komodo.h | 6 +++--- src/komodo_bitcoind.h | 2 +- src/komodo_notary.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index f94a54b57..6d11e2773 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -80,7 +80,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char else matched = (strcmp(symbol,ASSETCHAINS_SYMBOL) == 0); if ( fread(&ht,1,sizeof(ht),fp) != sizeof(ht) ) errs++; - if ( ASSETCHAINS_SYMBOL[0] != 0 && func != 'T' ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && func != 'T' ) printf("[%s] matched.%d fpos.%ld func.(%d %c) ht.%d\n",ASSETCHAINS_SYMBOL,matched,ftell(fp),func,func,ht); if ( func == 'P' ) { @@ -157,7 +157,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char { if ( fread(opret,1,olen,fp) != olen ) errs++; - if ( ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) { int32_t i; for (i=0; iNOTARIZED_HEIGHT,sp->CURRENT_HEIGHT,opretlen,scriptbuf[len+32*2+4],scriptbuf[len+32*2+4+1],scriptbuf[len+32*2+4+2]); if ( j == 1 && opretlen >= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) { diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 390d84736..1db988f12 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -463,7 +463,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( (txjson= jobj(json,(char *)"result")) != 0 && (vouts= jarray(&n,txjson,(char *)"vout")) > 0 ) { vout = jitem(vouts,n-1); - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) printf("vout.(%s)\n",jprint(vout,0)); if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 ) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d159c3d9f..7795161ab 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -289,7 +289,7 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not printf("komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); return; } - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); portable_mutex_lock(&komodo_mutex); sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); From 05c1e522c0672341171124476becbe582bab709c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 13:54:39 +0300 Subject: [PATCH 19/23] Test --- src/komodo.h | 4 ++-- src/komodo_bitcoind.h | 2 +- src/komodo_events.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 6d11e2773..2362ab142 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -406,7 +406,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0); len += 4; if ( ASSETCHAINS_SYMBOL[0] != 0 ) - printf("%s ht.%d NOTARIZED.%d %s.%s %sTXID.%s (%s) lens.(%d %d)\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),(char *)&scriptbuf[len],opretlen,len); + printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s (%s) lens.(%d %d)\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),(char *)&scriptbuf[len],opretlen,len); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( signedfp == 0 ) @@ -596,7 +596,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) printf(") "); - if ( ASSETCHAINS_SYMBOL[0] == 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification); if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) ) { diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1db988f12..e4d216741 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -427,7 +427,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str()); if ( strcmp(symbol,ASSETCHAINS_SYMBOL[0]==0?(char *)"KMD":ASSETCHAINS_SYMBOL) != 0 ) return(0); - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT); if ( strcmp(dest,"KMD") == 0 ) { diff --git a/src/komodo_events.h b/src/komodo_events.h index 886854fd6..753413e9f 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -46,7 +46,7 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig } else { - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"validated [%s] ht.%d notarized %d\n",ASSETCHAINS_SYMBOL,height,notarizedheight); memset(&N,0,sizeof(N)); N.blockhash = notarized_hash; From 514018d9ac37c314a3380ba7fcf3c5139d79fe60 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 14:36:00 +0300 Subject: [PATCH 20/23] Test --- src/komodo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 2362ab142..77e67645f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -105,7 +105,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char if ( fread(¬arized_desttxid,1,sizeof(notarized_desttxid),fp) != sizeof(notarized_desttxid) ) errs++; if ( ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 ) - printf("%s load[%s.%d] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,notarized_height,notarized_hash.ToString().c_str()); + printf("%s load[%s.%d -> %s] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str()); //if ( matched != 0 ) global independent states -> inside *sp komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height); } @@ -208,6 +208,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL); return; } + printf("[%s] (%s) -> (%s)\n",ASSETCHAINS_SYMBOL,symbol,dest); if ( fp == 0 ) { komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"komodostate"); From ca74f186938e8bdf70b4bf811e01506248a17e3c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 14:39:25 +0300 Subject: [PATCH 21/23] Test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 77e67645f..b8ab21a3f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -208,7 +208,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL); return; } - printf("[%s] (%s) -> (%s)\n",ASSETCHAINS_SYMBOL,symbol,dest); + //printf("[%s] (%s) -> (%s)\n",ASSETCHAINS_SYMBOL,symbol,dest); if ( fp == 0 ) { komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"komodostate"); From 5d1193043af785f16c9413391784f798ec35ca5d Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 14:39:53 +0300 Subject: [PATCH 22/23] Test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index b8ab21a3f..2eb0aa21f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -104,7 +104,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char errs++; if ( fread(¬arized_desttxid,1,sizeof(notarized_desttxid),fp) != sizeof(notarized_desttxid) ) errs++; - if ( ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 ) printf("%s load[%s.%d -> %s] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str()); //if ( matched != 0 ) global independent states -> inside *sp komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height); From 78b3ac8f87a666080da4aa95914455066d202a89 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Oct 2017 14:58:43 +0300 Subject: [PATCH 23/23] Test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 7795161ab..486b6c10e 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -356,7 +356,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n } if ( np != 0 ) { - char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); + //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); *notarized_hashp = np->notarized_hash; *notarized_desttxidp = np->notarized_desttxid; return(np->notarized_height);