test
This commit is contained in:
@@ -51,9 +51,9 @@ struct pax_transaction *komodo_paxmark(int32_t height,struct pax_transaction *sp
|
||||
return(pax);
|
||||
}
|
||||
|
||||
void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,int32_t height,int32_t otherheight,char *source) // assetchain context
|
||||
void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context
|
||||
{
|
||||
struct pax_transaction *pax; int32_t addflag = 0; struct komodo_state *sp; char str[16],dest[16];
|
||||
struct pax_transaction *pax; int32_t addflag = 0; struct komodo_state *sp; char str[16],dest[16],*s;
|
||||
sp = komodo_stateptr(str,dest);
|
||||
pthread_mutex_lock(&komodo_mutex);
|
||||
HASH_FIND(hh,PAX,&txid,sizeof(txid),pax);
|
||||
@@ -92,7 +92,12 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t
|
||||
if ( pax->marked == 0 )
|
||||
{
|
||||
if ( addflag != 0 )
|
||||
printf("[%s] addflag.%d ADD %s %s %.8f -> %s TO PAX ht.%d otherht.%d total %.8f\n",ASSETCHAINS_SYMBOL,addflag,ASSETCHAINS_SYMBOL[0]==0?"WITHDRAW":"DEPOSIT",symbol,dstr(ASSETCHAINS_SYMBOL[0]==0?pax->komodoshis:pax->fiatoshis),pax->coinaddr,pax->height,pax->otherheight,dstr(komodo_paxtotal()));
|
||||
{
|
||||
if ( (pax->approved= approved) != 0 )
|
||||
s = (char *)"APPROVED";
|
||||
else s = (char *)(ASSETCHAINS_SYMBOL[0]==0?"WITHDRAW":"DEPOSIT");
|
||||
printf("[%s] addflag.%d ADD %s %s %.8f -> %s TO PAX ht.%d otherht.%d total %.8f\n",ASSETCHAINS_SYMBOL,addflag,s,symbol,dstr(ASSETCHAINS_SYMBOL[0]==0?pax->komodoshis:pax->fiatoshis),pax->coinaddr,pax->height,pax->otherheight,dstr(komodo_paxtotal()));
|
||||
}
|
||||
}
|
||||
//else printf("%p MARKED.%d DEPOSIT %s %.8f -> %s TO PAX ht.%d otherht.%d\n",pax,pax->marked,symbol,dstr(fiatoshis),coinaddr,height,otherheight);
|
||||
}
|
||||
@@ -138,7 +143,6 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio
|
||||
memcpy(pax->rmd160,&opretbuf[len],20), len += 20;
|
||||
for (i=0; i<4; i++)
|
||||
pax->source[i] = opretbuf[len++];
|
||||
printf("%02x %02x %02x %02x %s\n",pax->source[0],pax->source[1],pax->source[2],pax->source[3],pax->source);
|
||||
}
|
||||
return(len);
|
||||
}
|
||||
@@ -422,7 +426,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
{
|
||||
if ( komodo_paxfind(&space,txid,vout) == 0 )
|
||||
{
|
||||
komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,kmdheight,height,(char *)"KMD");
|
||||
komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,kmdheight,height,(char *)"KMD",0);
|
||||
} else printf("duplicate deposit\n");
|
||||
}
|
||||
}
|
||||
@@ -444,7 +448,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
{
|
||||
printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",ASSETCHAINS_SYMBOL,dstr(value),dstr(komodoshis),kmdheight,height);
|
||||
}
|
||||
komodo_gateway_deposit(coinaddr,komodoshis,(char *)"KMD",value,rmd160,txid,vout,kmdheight,height,source);
|
||||
komodo_gateway_deposit(coinaddr,komodoshis,(char *)"KMD",value,rmd160,txid,vout,kmdheight,height,source,0);
|
||||
}
|
||||
}
|
||||
else if ( tokomodo != 0 && opretbuf[0] == 'A' )
|
||||
@@ -463,7 +467,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
if ( (pax= komodo_paxfind(&space,txids[i],vouts[i])) == 0 && baseids[i] >= 0 )
|
||||
{
|
||||
bitcoin_address(coinaddr,60,&rmd160s[i*20],20);
|
||||
komodo_gateway_deposit(coinaddr,0,0,0,0,txids[i],vouts[i],kmdheights[i],otherheights[i],CURRENCIES[baseids[i]]);
|
||||
komodo_gateway_deposit(coinaddr,0,0,0,0,txids[i],vouts[i],kmdheights[i],otherheights[i],CURRENCIES[baseids[i]],kmdheights[i]);
|
||||
printf("i.%d (%s) <- %.8f\n",i,coinaddr,dstr(values[i]));
|
||||
} else printf("i.%d pax.%p baseids[] %d\n",i,pax,baseids[i]);
|
||||
if ( (pax= komodo_paxfind(&space,txids[i],vouts[i])) != 0 )
|
||||
@@ -485,7 +489,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
{
|
||||
bitcoin_address(coinaddr,60,&rmd160s[i*20],20);
|
||||
if ( komodo_paxmark(height,&space,txids[i],vouts[i],height) == 0 && baseids[i] >= 0 )
|
||||
komodo_gateway_deposit(coinaddr,0,0,0,0,txids[i],vouts[i],height,0,CURRENCIES[baseids[i]]);
|
||||
komodo_gateway_deposit(coinaddr,0,0,0,0,txids[i],vouts[i],height,0,CURRENCIES[baseids[i]],0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ Value minerids(const Array& params, bool fHelp)
|
||||
int32_t height = atoi(params[0].get_str().c_str());
|
||||
if ( height <= 0 )
|
||||
height = chainActive.Tip()->nHeight;
|
||||
if ( (n= komodo_minerids(minerids,height)) > 0 && n <= 64 )
|
||||
if ( (n= komodo_minerids(minerids,height)) > 0 )
|
||||
{
|
||||
memset(tally,0,sizeof(tally));
|
||||
numnotaries = komodo_notaries(pubkeys,height);
|
||||
|
||||
Reference in New Issue
Block a user