test
This commit is contained in:
@@ -121,9 +121,7 @@ int32_t komodo_gateway_depositremove(uint256 txid,uint16_t vout) // assetchain c
|
|||||||
const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout)
|
const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout)
|
||||||
{
|
{
|
||||||
uint8_t rmd160[20],addrtype,shortflag,pubkey33[33]; int32_t i,j,len,tokomodo=0; char base[4],coinaddr[64],destaddr[64]; int64_t fiatoshis,checktoshis; const char *typestr = "unknown";
|
uint8_t rmd160[20],addrtype,shortflag,pubkey33[33]; int32_t i,j,len,tokomodo=0; char base[4],coinaddr[64],destaddr[64]; int64_t fiatoshis,checktoshis; const char *typestr = "unknown";
|
||||||
#ifdef KOMODO_ISSUER
|
tokomodo = (komodo_is_issuer() == 0);
|
||||||
tokomodo = 1;
|
|
||||||
#endif
|
|
||||||
if ( opretbuf[0] == ((tokomodo != 0) ? 'D' : 'W') )
|
if ( opretbuf[0] == ((tokomodo != 0) ? 'D' : 'W') )
|
||||||
{
|
{
|
||||||
if ( opretlen == 34 )
|
if ( opretlen == 34 )
|
||||||
@@ -134,6 +132,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|||||||
fiatoshis = -fiatoshis;
|
fiatoshis = -fiatoshis;
|
||||||
bitcoin_address(coinaddr,addrtype,rmd160,20);
|
bitcoin_address(coinaddr,addrtype,rmd160,20);
|
||||||
checktoshis = PAX_fiatdest(tokomodo,destaddr,pubkey33,coinaddr,height,base,fiatoshis);
|
checktoshis = PAX_fiatdest(tokomodo,destaddr,pubkey33,coinaddr,height,base,fiatoshis);
|
||||||
|
typestr = "deposit";
|
||||||
|
if ( tokomodo == 0 && strncmp(KOMODO_SOURCE,base,strlen(base)) == 0 )
|
||||||
|
{
|
||||||
for (i=0; i<opretlen; i++)
|
for (i=0; i<opretlen; i++)
|
||||||
printf("%02x",opretbuf[i]);
|
printf("%02x",opretbuf[i]);
|
||||||
printf(" DEPOSIT %.8f %c%s -> %s ",dstr(fiatoshis),shortflag!=0?'-':'+',base,coinaddr);
|
printf(" DEPOSIT %.8f %c%s -> %s ",dstr(fiatoshis),shortflag!=0?'-':'+',base,coinaddr);
|
||||||
@@ -143,21 +144,23 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|||||||
for (i=0; i<33; i++)
|
for (i=0; i<33; i++)
|
||||||
printf("%02x",pubkey33[i]);
|
printf("%02x",pubkey33[i]);
|
||||||
printf(" checkpubkey check %.8f v %.8f dest.(%s)\n",dstr(checktoshis),dstr(value),destaddr);
|
printf(" checkpubkey check %.8f v %.8f dest.(%s)\n",dstr(checktoshis),dstr(value),destaddr);
|
||||||
typestr = "deposit";
|
if ( value >= (9999*checktoshis)/10000 && shortflag == ASSETCHAINS_SHORTFLAG )
|
||||||
#ifdef KOMODO_ISSUER
|
|
||||||
if ( strncmp(KOMODO_SOURCE,base,strlen(base)) == 0 && value >= (9999*checktoshis)/10000 && shortflag == ASSETCHAINS_SHORTFLAG )
|
|
||||||
{
|
{
|
||||||
komodo_gateway_deposit(value,shortflag,base,fiatoshis,rmd160,txid,vout);
|
komodo_gateway_deposit(value,shortflag,base,fiatoshis,rmd160,txid,vout);
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
if ( tokomodo != 0 && value <= (10000*checktoshis)/9999 )
|
else
|
||||||
|
{
|
||||||
|
if ( value <= (10000*checktoshis)/9999 )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( tokomodo == 0 && strncmp(KOMODO_SOURCE,base,strlen(base)) == 0 )
|
||||||
{
|
{
|
||||||
for (i=0; i<opretlen; i++)
|
for (i=0; i<opretlen; i++)
|
||||||
printf("%02x",opretbuf[i]);
|
printf("%02x",opretbuf[i]);
|
||||||
@@ -182,6 +185,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return(typestr);
|
return(typestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -800,6 +800,13 @@ int32_t komodo_baseid(char *origbase)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t komodo_is_issuer()
|
||||||
|
{
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && COINBASE_MATURITY == 1 )
|
||||||
|
return(1);
|
||||||
|
else return(0);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t _unhex(char c)
|
int32_t _unhex(char c)
|
||||||
{
|
{
|
||||||
if ( c >= '0' && c <= '9' )
|
if ( c >= '0' && c <= '9' )
|
||||||
|
|||||||
Reference in New Issue
Block a user