Merge pull request #99 from jl777/dev

Dev
This commit is contained in:
jl777
2016-12-22 19:28:38 +02:00
committed by GitHub

View File

@@ -89,6 +89,7 @@ struct pax_transaction *komodo_paxmark(int32_t height,uint256 txid,uint16_t vout
void komodo_paxdelete(struct pax_transaction *pax)
{
return;
pthread_mutex_lock(&komodo_mutex);
HASH_DELETE(hh,PAX,pax);
pthread_mutex_unlock(&komodo_mutex);
@@ -319,8 +320,10 @@ uint64_t komodo_paxtotal()
else if ( pax->validated == 0 )
{
pax->validated = pax->komodoshis = checktoshis;
if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 )
printf("got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis));
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));
}
}
}
@@ -419,9 +422,13 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic
if ( pax->marked == 0 && strcmp((char *)"KMD",pax->symbol) == 0 && pax->approved == 0 && pax->validated != 0 )
{
if ( n < sizeof(paxes)/sizeof(*paxes) )
{
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));
}
}
opretstr[0] = 0;
@@ -800,7 +807,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
bitcoin_address(coinaddr,addrtype,rmd160,20);
checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,value);
typestr = "withdraw";
if ( 0 && strcmp(base,"RUB") == 0 )
if ( strcmp(base,"RUB") == 0 )
printf("RUB WITHDRAW %s.height.%d vs height.%d check %.8f/%.8f vs %.8f tokomodo.%d %d seed.%llx -> (%s) len.%d\n",ASSETCHAINS_SYMBOL,kmdheight,height,dstr(checktoshis),dstr(komodoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed,coinaddr,opretlen);
didstats = 0;
//if ( komodo_paxcmp(base,kmdheight,komodoshis,checktoshis,seed) == 0 )
@@ -812,7 +819,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
basesp->withdrawn += value;
didstats = 1;
if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
printf("########### %p withdrawn %s += %.8f\n",basesp,base,dstr(value));
printf("########### %p withdrawn %s += %.8f check %.8f\n",basesp,base,dstr(value),dstr(checktoshis));
}
if ( 0 && strcmp(base,"RUB") == 0 && (pax == 0 || pax->approved == 0) )
printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",ASSETCHAINS_SYMBOL,dstr(value),dstr(komodoshis),kmdheight,height);
@@ -851,9 +858,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
//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++)
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]);*/
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);
@@ -870,7 +877,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
basesp->approved += values[i];
didstats = 1;
//if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 )
printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis));
printf("pax.%p ########### %p approved %s += %.8f -> %.8f/%.8f kht.%d %d\n",pax,basesp,CURRENCIES[baseids[i]],dstr(values[i]),dstr(srcvalues[i]),dstr(checktoshis),kmdheights[i],otherheights[i]);
}
//printf(" i.%d (%s) <- %.8f ADDFLAG APPROVED\n",i,coinaddr,dstr(values[i]));
}