This commit is contained in:
jl777
2016-11-07 16:08:35 -03:00
parent 1e004600c7
commit 0bda624914
4 changed files with 16 additions and 36 deletions

View File

@@ -382,7 +382,7 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
uint32_t komodo_txtime(uint256 hash);
uint64_t komodo_paxprice(int32_t height,char *base,char *rel,uint64_t basevolume);
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume);
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel);
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height);
char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len);
@@ -434,16 +434,17 @@ Value paxprice(const Array& params, bool fHelp)
if ( fHelp || params.size() < 3 || params.size() > 4 )
throw runtime_error("paxprice \"base\" \"rel\" height amount\n");
LOCK(cs_main);
Object ret; uint64_t basevolume=0,relvolume;
Object ret; uint64_t basevolume=0,relvolume,seed;
std::string base = params[0].get_str();
std::string rel = params[1].get_str();
int32_t height = atoi(params[2].get_str().c_str());
if ( params.size() == 3 || (basevolume= COIN * atof(params[3].get_str().c_str())) == 0 )
basevolume = COIN;
relvolume = komodo_paxprice(height,(char *)base.c_str(),(char *)rel.c_str(),basevolume);
relvolume = komodo_paxprice(&seed,height,(char *)base.c_str(),(char *)rel.c_str(),basevolume);
ret.push_back(Pair("base", base));
ret.push_back(Pair("rel", rel));
ret.push_back(Pair("height", height));
ret.push_back(Pair("seed", seed));
if ( height < 0 || height > chainActive.Height() )
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
else