Rename CClaimTrieCache to CClaimTrieUpdateBuffer #156
2 changed files with 52 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -45,7 +45,7 @@ src/qt/forms/ui_*.h
|
||||||
|
|
||||||
src/qt/test/moc*.cpp
|
src/qt/test/moc*.cpp
|
||||||
|
|
||||||
dependencies/*
|
lbrycrd-dependencies/*
|
||||||
|
|
||||||
.deps
|
.deps
|
||||||
.dirstamp
|
.dirstamp
|
||||||
|
@ -74,6 +74,7 @@ dependencies/*
|
||||||
#libtool object files
|
#libtool object files
|
||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
|
start_time
|
||||||
|
|
||||||
# Compilation and Qt preprocessor part
|
# Compilation and Qt preprocessor part
|
||||||
*.qm
|
*.qm
|
||||||
|
|
|
@ -349,6 +349,55 @@ UniValue getclaimsforname(const UniValue& params, bool fHelp)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue getclaimbyid(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
if (fHelp || params.size() != 1)
|
||||||
|
throw std::runtime_error(
|
||||||
|
"getclaimbyid\n"
|
||||||
|
"Get a claim by claim id\n"
|
||||||
|
"Arguments: \n"
|
||||||
|
"1. \"claimId\" (string) the claimId of this claim\n"
|
||||||
|
"Result:\n"
|
||||||
|
"{\n"
|
||||||
|
" \"name\" (string) the name of the claim\n"
|
||||||
|
" \"value\" (string) claim metadata\n"
|
||||||
|
" \"claimId\" (string) the claimId of this claim\n"
|
||||||
|
" \"txid\" (string) the hash of the transaction which has successfully claimed this name\n"
|
||||||
|
" \"n\" (numeric) vout value\n"
|
||||||
|
" \"amount\" (numeric) txout value\n"
|
||||||
|
" \"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n"
|
||||||
|
" \"height\" (numeric) the height of the block in which this claim transaction is located\n"
|
||||||
|
"}\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
LOCK(cs_main);
|
||||||
|
uint160 claimId;
|
||||||
|
claimId.SetHex(params[0].get_str());
|
||||||
|
UniValue claim(UniValue::VOBJ);
|
||||||
|
std::vector<namedNodeType> nodes = pclaimTrie->flattenTrie();
|
||||||
|
for (std::vector<namedNodeType>::iterator it = nodes.begin(); it != nodes.end(); ++it) {
|
||||||
|
if (!it->second.claims.empty()) {
|
||||||
|
for (std::vector<CClaimValue>::iterator itClaims = it->second.claims.begin();
|
||||||
|
itClaims != it->second.claims.end(); ++itClaims) {
|
||||||
|
if (claimId == itClaims->claimId) {
|
||||||
|
std::string sValue;
|
||||||
|
getValueForClaim(itClaims->outPoint, sValue);
|
||||||
|
claim.push_back(Pair("name", it->first));
|
||||||
|
claim.push_back(Pair("value", sValue));
|
||||||
|
claim.push_back(Pair("claimId", itClaims->claimId.GetHex()));
|
||||||
|
claim.push_back(Pair("txid", itClaims->outPoint.hash.GetHex()));
|
||||||
|
claim.push_back(Pair("n", (int) itClaims->outPoint.n));
|
||||||
|
claim.push_back(Pair("amount", itClaims->nAmount));
|
||||||
|
claim.push_back(Pair("effective amount",
|
||||||
|
pclaimTrie->getEffectiveAmountForClaim(it->first, itClaims->claimId)));
|
||||||
|
claim.push_back(Pair("height", itClaims->nHeight));
|
||||||
|
return claim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return claim;
|
||||||
|
}
|
||||||
|
|
||||||
UniValue gettotalclaimednames(const UniValue& params, bool fHelp)
|
UniValue gettotalclaimednames(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
|
@ -710,6 +759,7 @@ static const CRPCCommand commands[] =
|
||||||
{ "Claimtrie", "gettotalvalueofclaims", &gettotalvalueofclaims, true },
|
{ "Claimtrie", "gettotalvalueofclaims", &gettotalvalueofclaims, true },
|
||||||
{ "Claimtrie", "getclaimsfortx", &getclaimsfortx, true },
|
{ "Claimtrie", "getclaimsfortx", &getclaimsfortx, true },
|
||||||
{ "Claimtrie", "getnameproof", &getnameproof, true },
|
{ "Claimtrie", "getnameproof", &getnameproof, true },
|
||||||
|
{ "Claimtrie", "getclaimbyid", &getclaimbyid, true },
|
||||||
};
|
};
|
||||||
|
|
||||||
void RegisterClaimTrieRPCCommands(CRPCTable &tableRPC)
|
void RegisterClaimTrieRPCCommands(CRPCTable &tableRPC)
|
||||||
|
|
Loading…
Reference in a new issue