From 8f68a6a7608363d50f4c3f9dae54bb591dbc1a4d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 20:58:50 +0200 Subject: [PATCH 01/17] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index cf7d01201..6ed8d8138 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -821,9 +821,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( kmdheight > 195000 || kmdheight <= height ) { didstats = 0; - if ( 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( strcmp("USD",ASSETCHAINS_SYMBOL) == 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) { - printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); + printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx paxcmp.%d\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed,komodo_paxcmp(base,kmdheight,value,checktoshis,0)); for (i=0; i<32; i++) printf("%02x",((uint8_t *)&txid)[i]); printf(" <- txid.v%u ",vout); From cfa255d35b08a075b13b4fa8b32ce93ff05959b9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:04:07 +0200 Subject: [PATCH 02/17] Test --- src/komodo_gateway.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 6ed8d8138..ddd54de2c 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -839,7 +839,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->deposited += fiatoshis; didstats = 1; - if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); } else printf("cant get stateptr.(%s)\n",base); komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"KMD",0); @@ -856,7 +856,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->deposited += fiatoshis; didstats = 1; - if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p depositedB %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis)); } } @@ -874,7 +874,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->issued += pax2->fiatoshis; pax2->didstats = 1; - if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight); } } From b61ed4395c2e81a124b055e978cfa41dbf77c515 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:15:51 +0200 Subject: [PATCH 03/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index ddd54de2c..d67e0fba9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -921,7 +921,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->didstats = 1; pax->height = pax2->height; pax->otherheight = height; - if ( 0 && strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + if ( strcmp("USD",ASSETCHAINS_SYMBOL) == 0 && strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p issuedb %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); } } From 9b445a1d0e64edc9becab9612c56ae588b829d4a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:24:33 +0200 Subject: [PATCH 04/17] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d67e0fba9..67f2cc749 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -787,7 +787,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source) { - uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; + uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64],str[65]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; const char *typestr = "unknown"; if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 && opretbuf[0] != 'K' ) { @@ -875,7 +875,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->issued += pax2->fiatoshis; pax2->didstats = 1; if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight); + printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d %s\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,pax2->txid)); } } } From 4c9da8cf5d00dbaca1e084126938a19b76ad8aba Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:26:53 +0200 Subject: [PATCH 05/17] Test --- src/komodo_gateway.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 67f2cc749..2d40c3262 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -787,7 +787,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source) { - uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64],str[65]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; + uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; const char *typestr = "unknown"; if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 && opretbuf[0] != 'K' ) { @@ -875,7 +875,11 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->issued += pax2->fiatoshis; pax2->didstats = 1; if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d %s\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,pax2->txid)); + { + char str[65]; bits256 tmp; + memcpy(&tmp,&pax2->txid,sizeof(tmp)); + printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d %s\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,tmp)); + } } } } From 05d80480128496afe4dde41c3f514a56f9bf7f25 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:31:02 +0200 Subject: [PATCH 06/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2d40c3262..6751cc07b 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -878,7 +878,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { char str[65]; bits256 tmp; memcpy(&tmp,&pax2->txid,sizeof(tmp)); - printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d %s\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,tmp)); + printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d (%s)\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,tmp)); } } } From 134c49d281ef5847780c69acb69b8edf1b6c97c0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:36:20 +0200 Subject: [PATCH 07/17] Test --- src/komodo_gateway.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 6751cc07b..57ee014cd 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -343,7 +343,7 @@ uint64_t komodo_paxtotal() HASH_ITER(hh,PAX,pax,tmp) { pax->ready = 0; - if ( 0 && pax->type == 'A' ) + if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) printf("%p pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); if ( pax->marked != 0 ) continue; @@ -821,7 +821,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( kmdheight > 195000 || kmdheight <= height ) { didstats = 0; - if ( strcmp("USD",ASSETCHAINS_SYMBOL) == 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp("USD",ASSETCHAINS_SYMBOL) == 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) { printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx paxcmp.%d\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed,komodo_paxcmp(base,kmdheight,value,checktoshis,0)); for (i=0; i<32; i++) @@ -839,7 +839,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->deposited += fiatoshis; didstats = 1; - if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); } else printf("cant get stateptr.(%s)\n",base); komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"KMD",0); @@ -856,7 +856,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->deposited += fiatoshis; didstats = 1; - if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p depositedB %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis)); } } @@ -874,7 +874,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->issued += pax2->fiatoshis; pax2->didstats = 1; - if ( 1 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) { char str[65]; bits256 tmp; memcpy(&tmp,&pax2->txid,sizeof(tmp)); From 9f22a3940bc711dba29637137d9769e5ada47d2c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:41:05 +0200 Subject: [PATCH 08/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 57ee014cd..127de8272 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -344,7 +344,7 @@ uint64_t komodo_paxtotal() { pax->ready = 0; if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) - printf("%p pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); + printf("(%s) pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax->coinaddr,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); if ( pax->marked != 0 ) continue; if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' ) From f06a20267695f53ec9e6185722eeed11f51655a0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:41:22 +0200 Subject: [PATCH 09/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 127de8272..00a0fed30 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -344,7 +344,7 @@ uint64_t komodo_paxtotal() { pax->ready = 0; if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) - printf("(%s) pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax->coinaddr,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); + printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax->coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); if ( pax->marked != 0 ) continue; if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' ) From 6ada6d9a008cd2fb0858ac39e16352238fa73566 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:42:09 +0200 Subject: [PATCH 10/17] Test --- src/komodo_gateway.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 00a0fed30..c59a67b02 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -343,8 +343,10 @@ uint64_t komodo_paxtotal() HASH_ITER(hh,PAX,pax,tmp) { pax->ready = 0; + char str[65]; bits256 tmp; + memcpy(&tmp,pax->txid,sizeof(tmp)); if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) - printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax->coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0); + printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d %s\n",pax->coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,bits256_str(str,tmp)); if ( pax->marked != 0 ) continue; if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' ) From 7658f5bdb117434e7ab2a9629a65670f22317cef Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:42:54 +0200 Subject: [PATCH 11/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c59a67b02..b60656781 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -344,7 +344,7 @@ uint64_t komodo_paxtotal() { pax->ready = 0; char str[65]; bits256 tmp; - memcpy(&tmp,pax->txid,sizeof(tmp)); + memcpy(&tmp,&pax->txid,sizeof(tmp)); if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d %s\n",pax->coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,bits256_str(str,tmp)); if ( pax->marked != 0 ) From d9229150424f7039f0be8fcdc854d254ba6ebbb7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:47:55 +0200 Subject: [PATCH 12/17] Test --- src/komodo_gateway.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b60656781..5628a8a93 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -343,10 +343,11 @@ uint64_t komodo_paxtotal() HASH_ITER(hh,PAX,pax,tmp) { pax->ready = 0; - char str[65]; bits256 tmp; + char str[65],coinaddr[64]; bits256 tmp; + bitcoin_address(coinaddr,60,pax->rmd160,20); memcpy(&tmp,&pax->txid,sizeof(tmp)); - if ( 1 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) - printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d %s\n",pax->coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,bits256_str(str,tmp)); + if ( 0 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' ) + printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d %s\n",coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,bits256_str(str,tmp)); if ( pax->marked != 0 ) continue; if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' ) From 5618b77a65c8b025dba7e7d5e9034b07a7f84e6c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 21:49:17 +0200 Subject: [PATCH 13/17] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 5628a8a93..af63957f9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -373,8 +373,8 @@ uint64_t komodo_paxtotal() { seed = 0; checktoshis = komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis); - //printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->komodoshis/COIN,(double)checktoshis/COIN); - //printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->komodoshis),pax->height,pax->otherheight); + printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->komodoshis/COIN,(double)checktoshis/COIN); + printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->komodoshis),pax->height,pax->otherheight); if ( seed != 0 && checktoshis != 0 ) { if ( checktoshis == pax->komodoshis ) From 9ae3d21c0cc4a4552477348ebf889a63e511b6e2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 22:12:57 +0200 Subject: [PATCH 14/17] Test --- src/komodo_gateway.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index af63957f9..8259824a8 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -373,8 +373,8 @@ uint64_t komodo_paxtotal() { seed = 0; checktoshis = komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis); - printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->komodoshis/COIN,(double)checktoshis/COIN); - printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->komodoshis),pax->height,pax->otherheight); + //printf("paxtotal PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",pax->height,pax->symbol,(double)pax->fiatoshis/COIN,(double)pax->komodoshis/COIN,(double)checktoshis/COIN); + //printf(" v%d %.8f k.%d ht.%d\n",pax->vout,dstr(pax->komodoshis),pax->height,pax->otherheight); if ( seed != 0 && checktoshis != 0 ) { if ( checktoshis == pax->komodoshis ) @@ -519,7 +519,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to { if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 ) printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); - continue; + //continue; } /*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0); if ( pax->marked != 0 || (pax->type != 'D' && pax->type != 'A') || pax->ready == 0 ) @@ -574,7 +574,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to PENDING_KOMODO_TX += pax->komodoshis; printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_KOMODO_TX)); } - if ( numvouts++ >= 64 ) + //if ( numvouts++ >= 64 ) break; } if ( numvouts > 1 ) From d4ab9b565af55cb89a4b88f93a95e9555122171c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 22:13:21 +0200 Subject: [PATCH 15/17] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 8259824a8..2c0e8a322 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -574,7 +574,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to PENDING_KOMODO_TX += pax->komodoshis; printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_KOMODO_TX)); } - //if ( numvouts++ >= 64 ) + if ( numvouts++ >= 1 ) break; } if ( numvouts > 1 ) From 4502c41e746aa251e4c586e1a946191aa1bc98ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 22:29:53 +0200 Subject: [PATCH 16/17] Test --- src/komodo_gateway.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2c0e8a322..93ca7b889 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -28,7 +28,8 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued, *withdrawn = sp->withdrawn; *approved = sp->approved; *redeemed = sp->redeemed; - netliability = (sp->deposited - sp->withdrawn) - sp->shorted; + //netliability = (sp->deposited - sp->withdrawn) - sp->shorted; + netliability = (sp->issued - MAX(sp->approved,sp->withdrawn)) - sp->shorted; maxallowed = komodo_maxallowed(baseid); if ( netliability < maxallowed ) *available = (maxallowed - netliability); @@ -519,7 +520,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to { if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 ) printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); - //continue; + pax->marked = pax->fiatoshis; + continue; } /*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0); if ( pax->marked != 0 || (pax->type != 'D' && pax->type != 'A') || pax->ready == 0 ) From 4445eeae6a66227e36ee0071336850d09356a3d5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 22:36:07 +0200 Subject: [PATCH 17/17] Test --- src/komodo_gateway.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 93ca7b889..b3eec1c66 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -17,7 +17,7 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base) { - int32_t baseid; struct komodo_state *sp; int64_t netliability,maxallowed; + int32_t baseid; struct komodo_state *sp; int64_t netliability,maxallowed,maxval; *available = *deposited = *issued = *withdrawn = *approved = *redeemed = 0; if ( (baseid= komodo_baseid(base)) >= 0 ) { @@ -29,7 +29,10 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued, *approved = sp->approved; *redeemed = sp->redeemed; //netliability = (sp->deposited - sp->withdrawn) - sp->shorted; - netliability = (sp->issued - MAX(sp->approved,sp->withdrawn)) - sp->shorted; + maxval = sp->approved; + if ( sp->withdrawn > maxval ) + maxval = sp->withdrawn; + netliability = (sp->issued - maxval) - sp->shorted; maxallowed = komodo_maxallowed(baseid); if ( netliability < maxallowed ) *available = (maxallowed - netliability);