Rename CClaimTrieCache to CClaimTrieUpdateBuffer #156
1 changed files with 15 additions and 13 deletions
|
@ -356,45 +356,47 @@ UniValue getclaimbyid(const UniValue& params, bool fHelp)
|
||||||
"getclaimbyid\n"
|
"getclaimbyid\n"
|
||||||
"Get a claim by claim id\n"
|
"Get a claim by claim id\n"
|
||||||
"Arguments: \n"
|
"Arguments: \n"
|
||||||
"1. \"claimId\" (string) the claimId of this claim\n"
|
"1. \"claimId\" (string) the claimId of this claim\n"
|
||||||
"Result:\n"
|
"Result:\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"name\" (string) the name of the claim\n"
|
" \"name\" (string) the name of the claim\n"
|
||||||
" \"claimId\" (string) the claimId of this claim\n"
|
" \"value\" (string) claim metadata\n"
|
||||||
" \"txid\" (string) the hash of the transaction which has successfully claimed this name\n"
|
" \"claimId\" (string) the claimId of this claim\n"
|
||||||
" \"n\" (numeric) vout value\n"
|
" \"txid\" (string) the hash of the transaction which has successfully claimed this name\n"
|
||||||
" \"amount\" (numeric) txout value\n"
|
" \"n\" (numeric) vout value\n"
|
||||||
" \"height\" (numeric) the height of the block in which this claim transaction is located\n"
|
" \"amount\" (numeric) txout value\n"
|
||||||
" \"value\" (string) claim metadata\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"
|
"}\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
uint160 claimId;
|
uint160 claimId;
|
||||||
claimId.SetHex(params[0].get_str());
|
claimId.SetHex(params[0].get_str());
|
||||||
|
UniValue claim(UniValue::VOBJ);
|
||||||
std::vector<namedNodeType> nodes = pclaimTrie->flattenTrie();
|
std::vector<namedNodeType> nodes = pclaimTrie->flattenTrie();
|
||||||
for (std::vector<namedNodeType>::iterator it = nodes.begin(); it != nodes.end(); ++it) {
|
for (std::vector<namedNodeType>::iterator it = nodes.begin(); it != nodes.end(); ++it) {
|
||||||
if (!it->second.claims.empty()) {
|
if (!it->second.claims.empty()) {
|
||||||
for (std::vector<CClaimValue>::iterator itClaims = it->second.claims.begin();
|
for (std::vector<CClaimValue>::iterator itClaims = it->second.claims.begin();
|
||||||
itClaims != it->second.claims.end(); ++itClaims) {
|
itClaims != it->second.claims.end(); ++itClaims) {
|
||||||
if (claimId == itClaims->claimId) {
|
if (claimId == itClaims->claimId) {
|
||||||
UniValue claim(UniValue::VOBJ);
|
|
||||||
std::string sValue;
|
std::string sValue;
|
||||||
getValueForClaim(itClaims->outPoint, sValue);
|
getValueForClaim(itClaims->outPoint, sValue);
|
||||||
claim.push_back(Pair("name", it->first));
|
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("claimId", itClaims->claimId.GetHex()));
|
||||||
claim.push_back(Pair("txid", itClaims->outPoint.hash.GetHex()));
|
claim.push_back(Pair("txid", itClaims->outPoint.hash.GetHex()));
|
||||||
claim.push_back(Pair("n", (int) itClaims->outPoint.n));
|
claim.push_back(Pair("n", (int) itClaims->outPoint.n));
|
||||||
claim.push_back(Pair("amount", ValueFromAmount(itClaims->nAmount)));
|
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));
|
claim.push_back(Pair("height", itClaims->nHeight));
|
||||||
claim.push_back(Pair("value", sValue));
|
|
||||||
return claim;
|
return claim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return claim;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue gettotalclaimednames(const UniValue& params, bool fHelp)
|
UniValue gettotalclaimednames(const UniValue& params, bool fHelp)
|
||||||
|
|
Loading…
Reference in a new issue