diff --git a/src/cc/dapps/oraclefeed.c b/src/cc/dapps/oraclefeed.c index 94ea2965c..219f2d391 100644 --- a/src/cc/dapps/oraclefeed.c +++ b/src/cc/dapps/oraclefeed.c @@ -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,9 +450,9 @@ 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++) + for (i=31; i>=0; i--) sprintf(&hexstr[8 + (31-i)*2],"%02x",blockhash.bytes[i]); - for (i=0; i<32; i++) + for (i=31; i>=0; i--) sprintf(&hexstr[8 + 64 + (31-i)*2],"%02x",merkleroot.bytes[i]); hexstr[8 + 64*2] = 0; return(height); @@ -508,9 +508,8 @@ int32_t main(int32_t argc,char **argv) while ( 1 ) { retstr = 0; - if ( (clijson= get_komodocli(&retstr,acname,"oraclesinfo",oraclestr,"","")) != 0 ) + if ( acheight < (get_KMDheight(acname) - 10) && (clijson= get_komodocli(&retstr,acname,"oraclesinfo",oraclestr,"","")) != 0 ) { - acheight = height; if ( (regjson= jarray(&n,clijson,"registered")) != 0 ) { for (i=0; i 9d80ea79a65aaa0d464f8b762356fa01047e16e9793505a22ca04559f81a6eb6 + to get the merkleroots onchain, from the multisig signers nodes run the oraclefeed program with acname oracletxid pubkey Ihh + ./oraclefeed AT5 1f1aefcca2bdea8196cfd77337fb21de22d200ddea977c2f9e8742c55829d808 02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92 Ihh + gatewaysclaim bindtxid coin deposittxid destpub amount ./c gatewaysclaim e6c99f79d4afb216aa8063658b4222edb773dd24bb0f8e91bd4ef341f3e47e5e KMD 9d80ea79a65aaa0d464f8b762356fa01047e16e9793505a22ca04559f81a6eb6 0223d114dededb04f253816d6ad0ce78dd08c617c94ce3c53bf50dc74a5157bef8 7.6999 */