Fix oracle feed

This commit is contained in:
jl777
2018-09-12 01:47:58 -11:00
parent 3420554d5c
commit c434b250a7
2 changed files with 8 additions and 5 deletions

View File

@@ -432,7 +432,7 @@ int32_t get_KMDheader(bits256 *blockhashp,bits256 *merklerootp,int32_t prevheigh
int32_t get_oracledata(int32_t prevheight,char *hexstr,int32_t maxsize,char *format)
{
uint32_t i,height; uint64_t price; bits256 blockhash,merkleroot;
int32_t i; uint32_t height; uint64_t price; bits256 blockhash,merkleroot;
hexstr[0] = 0;
if ( format[0] == 'L' || format[0] == 'l' )
{
@@ -450,10 +450,10 @@ int32_t get_oracledata(int32_t prevheight,char *hexstr,int32_t maxsize,char *for
{
for (i=0; i<4; i++)
sprintf(&hexstr[i*2],"%02x",(uint8_t)((height >> (i*8)) & 0xff));
for (i=0; i<32; i++)
sprintf(&hexstr[8 + (31-i)*2],"%02x",blockhash.bytes[i]);
for (i=0; i<32; i++)
sprintf(&hexstr[8 + 64 + (31-i)*2],"%02x",merkleroot.bytes[i]);
for (i=31; i>=0; i--)
sprintf(&hexstr[8 + i*2],"%02x",blockhash.bytes[31-i]);
for (i=31; i>=0; i--)
sprintf(&hexstr[8 + 64 + i*2],"%02x",merkleroot.bytes[31-i]);
hexstr[8 + 64*2] = 0;
return(height);
}