From 5720de88186ab373b6b08ce0a486ce051572416d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Dec 2016 19:31:41 +0200 Subject: [PATCH 1/8] 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 991cd4c0f..e42e67143 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -89,7 +89,7 @@ struct pax_transaction *komodo_paxmark(int32_t height,uint256 txid,uint16_t vout void komodo_paxdelete(struct pax_transaction *pax) { - return; + return; // breaks when out of order pthread_mutex_lock(&komodo_mutex); HASH_DELETE(hh,PAX,pax); pthread_mutex_unlock(&komodo_mutex); From 2fb657f6a5c30ded978636b88c1c1ee1c26ccc7b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Dec 2016 22:26:46 +0200 Subject: [PATCH 2/8] 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 e42e67143..ec8e40255 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -426,7 +426,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic paxes[n++] = pax; int32_t j; for (j=0; j<32; j++) printf("%02x",((uint8_t *)&pax->txid)[j]); - printf("%s.(kmdht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->komodoshis)); + printf(" %s.(kmdht.%d ht.%d marked.%u approved.%d validated %.8f) %.8f\n",pax->source,pax->height,pax->otherheight,pax->marked,pax->approved,dstr(pax->validated),dstr(pax->komodoshis)); } } } @@ -854,8 +854,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 continue; didstats = 0; seed = 0; - checktoshis = komodo_paxprice(&seed,kmdheights[i],CURRENCIES[baseids[i]],(char *)"KMD",(uint64_t)values[i]); - //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); + checktoshis = komodo_paxprice(&seed,kmdheights[i],CURRENCIES[baseids[i]],(char *)"KMD",(uint64_t)srcvalues[i]); + printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); if ( srcvalues[i] == checktoshis ) { for (j=0; j<32; j++) From d515094d1fdbb994e6c4d24a043a9b58ca32e146 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Dec 2016 22:31:19 +0200 Subject: [PATCH 3/8] 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 ec8e40255..ddc1c9223 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -840,7 +840,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 else if ( tokomodo != 0 && opretbuf[0] == 'A' ) { tokomodo = 1; - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) { for (i=0; i KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); if ( srcvalues[i] == checktoshis ) { From 8e7b40d93de3811385f026fc9e9e6104b57e28ff Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Dec 2016 22:42:05 +0200 Subject: [PATCH 4/8] test --- src/komodo_gateway.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index ddc1c9223..32adba763 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -190,7 +190,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[16]; if ( KOMODO_PAX == 0 ) return(0); - incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4)); + incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 2)); for (i=0; i<4; i++) base[i] = opretbuf[opretlen-4+i]; //for (i=0; i Date: Thu, 22 Dec 2016 22:46:23 +0200 Subject: [PATCH 5/8] 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 32adba763..aab52a8c3 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -193,10 +193,10 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 2)); for (i=0; i<4; i++) base[i] = opretbuf[opretlen-4+i]; - //for (i=0; i Date: Thu, 22 Dec 2016 22:54:00 +0200 Subject: [PATCH 6/8] test --- src/komodo_gateway.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index aab52a8c3..5f96ff6f1 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -193,10 +193,10 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 2)); for (i=0; i<4; i++) base[i] = opretbuf[opretlen-4+i]; - for (i=0; i 0 ) { for (i=0; i KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); if ( srcvalues[i] == checktoshis ) { - for (j=0; j<32; j++) - printf("%02x",((uint8_t *)&txids[i])[j]); - printf(" v%d %.8f k.%d ht.%d base.%d\n",vouts[i],dstr(values[i]),kmdheights[i],otherheights[i],baseids[i]); if ( (pax= komodo_paxfind(txids[i],vouts[i],'A')) == 0 ) { bitcoin_address(coinaddr,60,&rmd160s[i*20],20); From 5cb9312f6c6dc8f5d1a64fb21ed387982ab7398f Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Dec 2016 23:05:39 +0200 Subject: [PATCH 7/8] 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 5f96ff6f1..baa07961f 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -190,9 +190,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[16]; if ( KOMODO_PAX == 0 ) return(0); - incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 2)); - for (i=0; i<4; i++) - base[i] = opretbuf[opretlen-4+i]; + incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20)); //for (i=0; i Date: Thu, 22 Dec 2016 23:10:10 +0200 Subject: [PATCH 8/8] test --- src/komodo_gateway.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index baa07961f..040aa4ca9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -215,7 +215,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t otherheights[n] = p.otherheight; memcpy(&rmd160s[n * 20],p.rmd160,20); baseids[n] = komodo_baseid(p.source); - if ( 1 ) + if ( 0 ) { char coinaddr[64]; bitcoin_address(coinaddr,60,&rmd160s[n * 20],20); @@ -320,10 +320,10 @@ uint64_t komodo_paxtotal() else if ( pax->validated == 0 ) { pax->validated = pax->komodoshis = checktoshis; - int32_t j; for (j=0; j<32; j++) - printf("%02x",((uint8_t *)&pax->txid)[j]); + //int32_t j; for (j=0; j<32; j++) + // printf("%02x",((uint8_t *)&pax->txid)[j]); //if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) - printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); + // printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); } } } @@ -361,7 +361,7 @@ uint64_t komodo_paxtotal() { seed = 0; checktoshis = komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis); - printf("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("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 ) { @@ -840,7 +840,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 else if ( tokomodo != 0 && opretbuf[0] == 'A' ) { tokomodo = 1; - //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) { for (i=0; i KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); + //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f vs %.8f\n",kmdheights[i],CURRENCIES[baseids[i]],(double)values[i]/COIN,(double)srcvalues[i]/COIN,(double)checktoshis/COIN); if ( srcvalues[i] == checktoshis ) { if ( (pax= komodo_paxfind(txids[i],vouts[i],'A')) == 0 )