This commit is contained in:
jl777
2016-10-26 10:24:22 -03:00
parent aa96c787fa
commit 47e5cbc130
3 changed files with 18 additions and 9 deletions

View File

@@ -284,12 +284,7 @@ int32_t komodo_voutupdate(int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,
}
#ifdef KOMODO_PAX
else if ( i == 0 && scriptbuf[len] == 'P' )
{
double KMDBTC,BTCUSD,CNYUSD; uint32_t numpvals,timestamp,pvals[128];
numpvals = dpow_readprices(&scriptbuf[++len],&timestamp,&KMDBTC,&BTCUSD,&CNYUSD,pvals);
komodo_stateupdate(height,0,0,0,zero,0,0,pvals,numpvals,0,0,0);
printf("vout OP_RETURN.%d prices numpvals.%d opretlen.%d\n",height,numpvals,opretlen);
}
komodo_paxpricefeed(&scriptbuf[++len]);
#endif
}
return(notaryid);

View File

@@ -49,9 +49,14 @@ void komodo_gateway_voutupdate(char *symbol,int32_t height,int32_t txi,int32_t v
else
{
offset += komodo_scriptitemlen(&opretlen,&script[offset]);
printf("offset.%d opretlen.%d\n",offset,opretlen);
typestr = komodo_opreturn(height,&script[offset],opretlen);
komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,&script[offset],opretlen);
if ( script[offset] == 'P' )
komodo_paxpricefeed(&script[++offset]);
else
{
printf("offset.%d opretlen.%d\n",offset,opretlen);
typestr = komodo_opreturn(height,&script[offset],opretlen);
komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,&script[offset],opretlen);
}
}
}
else if ( numvouts > 13 )

View File

@@ -298,6 +298,15 @@ int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *bas
return(num);
}
void komodo_paxpricefeed(uint8_t *pricefeed)
{
double KMDBTC,BTCUSD,CNYUSD; uint32_t numpvals,timestamp,pvals[128]; uint256 zero;
numpvals = dpow_readprices(pricefeed,&timestamp,&KMDBTC,&BTCUSD,&CNYUSD,pvals);
memset(&zero,0,sizeof(zero));
komodo_stateupdate(height,0,0,0,zero,0,0,pvals,numpvals,0,0,0);
printf("komodo_paxpricefeed vout OP_RETURN.%d prices numpvals.%d opretlen.%d\n",height,numpvals,opretlen);
}
uint64_t PAX_fiatdest(char *fiatbuf,char *destaddr,uint8_t pubkey33[33],char *coinaddr,int32_t height,char *origbase,int64_t fiatoshis)
{
uint8_t shortflag = 0; char base[4]; int32_t i; uint8_t addrtype,rmd160[20]; uint64_t komodoshis = 0;