@@ -238,6 +238,30 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t
|
|||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t checkvalue,uint64_t seed)
|
||||||
|
{
|
||||||
|
int32_t ratio;
|
||||||
|
if ( seed == 0 && checkvalue != 0 )
|
||||||
|
{
|
||||||
|
ratio = ((value << 6) / checkvalue);
|
||||||
|
if ( ratio >= 63 && ratio <= 65 )
|
||||||
|
return(0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( kmdheight >= 86150 )
|
||||||
|
printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",kmdheight,symbol,(long long)value,(long long)checkvalue,ratio);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( checkvalue != 0 )
|
||||||
|
{
|
||||||
|
ratio = ((value << 10) / checkvalue);
|
||||||
|
if ( ratio >= 1023 && ratio <= 1025 )
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(value != checkvalue);
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t komodo_paxtotal()
|
uint64_t komodo_paxtotal()
|
||||||
{
|
{
|
||||||
struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[16],dest[16],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp;
|
struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[16],dest[16],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp;
|
||||||
@@ -274,8 +298,11 @@ uint64_t komodo_paxtotal()
|
|||||||
//bitcoin_address(coinaddr,addrtype,rmd160,20);
|
//bitcoin_address(coinaddr,addrtype,rmd160,20);
|
||||||
if ( (checktoshis= komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis)) != 0 )
|
if ( (checktoshis= komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis)) != 0 )
|
||||||
{
|
{
|
||||||
if ( checktoshis != pax->komodoshis )
|
if ( komodo_paxcmp(pax->source,pax->height,pax->komodoshis,checktoshis,seed) == 0 )
|
||||||
|
{
|
||||||
pax->marked = pax->height;
|
pax->marked = pax->height;
|
||||||
|
//printf("WITHDRAW.%s mark <- %d %.8f != %.8f\n",pax->source,pax->height,dstr(checktoshis),dstr(pax->komodoshis));
|
||||||
|
}
|
||||||
else if ( pax->validated == 0 )
|
else if ( pax->validated == 0 )
|
||||||
{
|
{
|
||||||
pax->validated = pax->komodoshis;
|
pax->validated = pax->komodoshis;
|
||||||
@@ -353,8 +380,8 @@ int32_t komodo_pending_withdraws(char *opretstr)
|
|||||||
if ( len == 0 )
|
if ( len == 0 )
|
||||||
opretbuf[len++] = 'A';
|
opretbuf[len++] = 'A';
|
||||||
len += komodo_rwapproval(1,&opretbuf[len],pax);
|
len += komodo_rwapproval(1,&opretbuf[len],pax);
|
||||||
//printf("%s.(marked.%u approved.%d) %p\n",pax->source,pax->marked,pax->approved,pax);
|
|
||||||
}
|
}
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
@@ -541,30 +568,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t checkvalue,uint64_t seed)
|
|
||||||
{
|
|
||||||
int32_t ratio;
|
|
||||||
if ( seed == 0 && checkvalue != 0 )
|
|
||||||
{
|
|
||||||
ratio = ((value << 6) / checkvalue);
|
|
||||||
if ( ratio >= 63 && ratio <= 65 )
|
|
||||||
return(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( kmdheight >= 86150 )
|
|
||||||
printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",kmdheight,symbol,(long long)value,(long long)checkvalue,ratio);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( checkvalue != 0 )
|
|
||||||
{
|
|
||||||
ratio = ((value << 10) / checkvalue);
|
|
||||||
if ( ratio >= 1023 && ratio <= 1025 )
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
return(value != checkvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source)
|
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,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 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,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 fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff;
|
||||||
|
|||||||
Reference in New Issue
Block a user