hacktober fest #214

Closed
Z3N00 wants to merge 304 commits from zeno into master
3 changed files with 8 additions and 32 deletions
Showing only changes of commit d117a97a41 - Show all commits

View file

@ -44,36 +44,6 @@ UniValue getclaimtrie(const UniValue& params, bool fHelp)
return ret; return ret;
} }
UniValue gettxinfoforname(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw std::runtime_error(
"gettxinfoforname \"name\"\n"
"Return information about the transaction that has successfully claimed a name, if one exists\n"
"Arguments:\n"
"1. \"name\" (string) the name about which to return info\n"
"Result: \n"
"\"txid\" (string) the hash of the transaction which successfully claimed the name\n"
"\"n\" (numeric) vout value\n"
"\"amount\" (numeric) txout amount\n"
"\"height\" (numeric) the height of the block in which this transaction is located\n"
);
LOCK(cs_main);
std::string name = params[0].get_str();
UniValue ret(UniValue::VOBJ);
CNodeValue val;
if (pclaimTrie->getInfoForName(name, val))
{
ret.push_back(Pair("txid", val.txhash.GetHex()));
ret.push_back(Pair("n", (int)val.nOut));
ret.push_back(Pair("amount", val.nAmount));
ret.push_back(Pair("height", val.nHeight));
}
return ret;
}
UniValue getvalueforname(const UniValue& params, bool fHelp) UniValue getvalueforname(const UniValue& params, bool fHelp)
{ {
if (fHelp || params.size() != 1) if (fHelp || params.size() != 1)
@ -84,6 +54,10 @@ UniValue getvalueforname(const UniValue& params, bool fHelp)
"1. \"name\" (string) the name to look up\n" "1. \"name\" (string) the name to look up\n"
"Result: \n" "Result: \n"
"\"value\" (string) the value of the name, if it exists\n" "\"value\" (string) the value of the name, if it exists\n"
"\"txid\" (string) the hash of the transaction which successfully claimed the name\n"
"\"n\" (numeric) vout value\n"
"\"amount\" (numeric) txout amount\n"
"\"height\" (numeric) the height of the block in which this transaction is located\n"
); );
LOCK(cs_main); LOCK(cs_main);
std::string name = params[0].get_str(); std::string name = params[0].get_str();
@ -113,6 +87,10 @@ UniValue getvalueforname(const UniValue& params, bool fHelp)
} }
std::string sValue(vvchParams[1].begin(), vvchParams[1].end()); std::string sValue(vvchParams[1].begin(), vvchParams[1].end());
ret.push_back(Pair("value", sValue)); ret.push_back(Pair("value", sValue));
ret.push_back(Pair("txid", val.txhash.GetHex()));
ret.push_back(Pair("n", (int)val.nOut));
ret.push_back(Pair("amount", val.nAmount));
ret.push_back(Pair("height", val.nHeight));
return ret; return ret;
} }

View file

@ -380,7 +380,6 @@ static const CRPCCommand vRPCCommands[] =
/* Claim trie */ /* Claim trie */
{ "claimtrie", "getclaimtrie", &getclaimtrie, true }, { "claimtrie", "getclaimtrie", &getclaimtrie, true },
{ "claimtrie", "gettxinfoforname", &gettxinfoforname, true },
{ "claimtrie", "getvalueforname", &getvalueforname, true }, { "claimtrie", "getvalueforname", &getvalueforname, true },
{ "claimtrie", "gettotalclaimednames", &gettotalclaimednames, true }, { "claimtrie", "gettotalclaimednames", &gettotalclaimednames, true },
{ "claimtrie", "gettotalclaims", &gettotalclaims, true }, { "claimtrie", "gettotalclaims", &gettotalclaims, true },

View file

@ -269,7 +269,6 @@ extern UniValue invalidateblock(const UniValue& params, bool fHelp);
extern UniValue reconsiderblock(const UniValue& params, bool fHelp); extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
extern UniValue getclaimtrie(const UniValue& params, bool fHelp); // in rpcclaimtrie.cpp extern UniValue getclaimtrie(const UniValue& params, bool fHelp); // in rpcclaimtrie.cpp
extern UniValue gettxinfoforname(const UniValue& params, bool fHelp);
extern UniValue getvalueforname(const UniValue& params, bool fHelp); extern UniValue getvalueforname(const UniValue& params, bool fHelp);
extern UniValue gettotalclaimednames(const UniValue& params, bool fHelp); extern UniValue gettotalclaimednames(const UniValue& params, bool fHelp);
extern UniValue gettotalclaims(const UniValue& params, bool fHelp); extern UniValue gettotalclaims(const UniValue& params, bool fHelp);