test
This commit is contained in:
@@ -404,6 +404,33 @@ 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);
|
||||
uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n);
|
||||
int32_t komodo_minerids(uint8_t *minerids,int32_t height);
|
||||
int32_t komodo_kvsearch(uint8_t value[IGUANA_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
|
||||
Value kvsearch(const Array& params, bool fHelp)
|
||||
{
|
||||
Object ret; uint8_t value[IGUANA_MAXSCRIPTSIZE],key[IGUANA_MAXSCRIPTSIZE]; int32_t j,valuesize,keylen;
|
||||
LOCK(cs_main);
|
||||
if ( (keylen= (int32_t)strlen(params[0].get_str().c_str())) > 0 )
|
||||
{
|
||||
if ( keylen < sizeof(key) )
|
||||
{
|
||||
memcpy(key,params[0].get_str().c_str(),keylen);
|
||||
if ( (valuesize= komodo_kvsearch(value,key,keylen)) >= 0 )
|
||||
{
|
||||
std::string value; char *valuestr; int32_t m;
|
||||
value.resize(valuesize+1);
|
||||
hexstr = (char *)value.data();
|
||||
memcpy(valuestr,value,valuesize);
|
||||
valuestr[valuesize] = 0;
|
||||
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
|
||||
ret.push_back(Pair("key",params[0].get_str()));
|
||||
ret.push_back(Pair("value",value));
|
||||
ret.push_back(Pair("height", (int64_t)chainActive.Tip()->nHeight));
|
||||
} else ret.push_back(Pair("error",(char *)"cant find key"));
|
||||
} else ret.push_back(Pair("error",(char *)"key too big"));
|
||||
} else ret.push_back(Pair("error",(char *)"null key"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
Value minerids(const Array& params, bool fHelp)
|
||||
{
|
||||
|
||||
@@ -112,6 +112,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||
{ "paxpending", 0 },
|
||||
{ "notaries", 1 },
|
||||
{ "minerids", 1 },
|
||||
{ "kvsearch", 1 },
|
||||
};
|
||||
|
||||
class CRPCConvertTable
|
||||
|
||||
@@ -305,6 +305,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "blockchain", "paxprices", &paxprices, true },
|
||||
{ "blockchain", "notaries", ¬aries, true },
|
||||
{ "blockchain", "minerids", &minerids, true },
|
||||
{ "blockchain", "kvsearch", &kvsearch, true },
|
||||
|
||||
/* Mining */
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
||||
|
||||
@@ -247,6 +247,7 @@ extern json_spirit::Value gettxoutsetinfo(const json_spirit::Array& params, bool
|
||||
extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value notaries(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value minerids(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value kvsearch(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value paxprice(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value paxpending(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value paxprices(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
Reference in New Issue
Block a user