Rename CClaimTrieCache to CClaimTrieUpdateBuffer #156
3 changed files with 26 additions and 1 deletions
|
@ -87,6 +87,14 @@ bool CNCCTrieNode::getBestValue(CNodeValue& value) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CNCCTrieNode::haveValue(const uint256& txhash, uint32_t nOut) const
|
||||||
|
{
|
||||||
|
for (std::vector<CNodeValue>::const_iterator itval = values.begin(); itval != values.end(); ++itval)
|
||||||
|
if (itval->txhash == txhash && itval->nOut == nOut)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint256 CNCCTrie::getMerkleHash()
|
uint256 CNCCTrie::getMerkleHash()
|
||||||
{
|
{
|
||||||
return root.hash;
|
return root.hash;
|
||||||
|
@ -102,6 +110,19 @@ bool CNCCTrie::queueEmpty() const
|
||||||
return valueQueue.empty();
|
return valueQueue.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CNCCTrie::haveClaim(const std::string& name, const uint256& txhash, uint32_t nOut) const
|
||||||
|
{
|
||||||
|
const CNCCTrieNode* current = &root;
|
||||||
|
for (std::string::const_iterator itname = name.begin(); itname != name.end(); ++itname)
|
||||||
|
{
|
||||||
|
nodeMapType::const_iterator itchildren = current->children.find(*itname);
|
||||||
|
if (itchildren == current->children.end())
|
||||||
|
return false;
|
||||||
|
current = itchildren->second;
|
||||||
|
}
|
||||||
|
return current->haveValue(txhash, nOut);
|
||||||
|
}
|
||||||
|
|
||||||
bool CNCCTrie::recursiveDumpToJSON(const std::string& name, const CNCCTrieNode* current, json_spirit::Array& ret) const
|
bool CNCCTrie::recursiveDumpToJSON(const std::string& name, const CNCCTrieNode* current, json_spirit::Array& ret) const
|
||||||
{
|
{
|
||||||
using namespace json_spirit;
|
using namespace json_spirit;
|
||||||
|
|
|
@ -88,7 +88,7 @@ public:
|
||||||
bool removeValue(uint256& txhash, uint32_t nOut, CNodeValue& val, bool * fChanged = NULL);
|
bool removeValue(uint256& txhash, uint32_t nOut, CNodeValue& val, bool * fChanged = NULL);
|
||||||
bool getBestValue(CNodeValue& val) const;
|
bool getBestValue(CNodeValue& val) const;
|
||||||
bool empty() const {return children.empty() && values.empty();}
|
bool empty() const {return children.empty() && values.empty();}
|
||||||
|
bool haveValue(const uint256& txhash, uint32_t nOut) const;
|
||||||
ADD_SERIALIZE_METHODS;
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
template <typename Stream, typename Operation>
|
template <typename Stream, typename Operation>
|
||||||
|
@ -159,6 +159,7 @@ public:
|
||||||
bool getInfoForName(const std::string& name, CNodeValue& val) const;
|
bool getInfoForName(const std::string& name, CNodeValue& val) const;
|
||||||
int nCurrentHeight;
|
int nCurrentHeight;
|
||||||
bool queueEmpty() const;
|
bool queueEmpty() const;
|
||||||
|
bool haveClaim(const std::string& name, const uint256& txhash, uint32_t nOut) const;
|
||||||
friend class CNCCTrieCache;
|
friend class CNCCTrieCache;
|
||||||
private:
|
private:
|
||||||
bool update(nodeCacheType& cache, hashMapType& hashes, const uint256& hashBlock, valueQueueType& queueCache, int nNewHeight);
|
bool update(nodeCacheType& cache, hashMapType& hashes, const uint256& hashBlock, valueQueueType& queueCache, int nNewHeight);
|
||||||
|
|
|
@ -610,6 +610,9 @@ void ListNameClaims(const CWalletTx& wtx, const string& strAccount, int nMinDept
|
||||||
entry.push_back(Pair("amount", ValueFromAmount(s.amount)));
|
entry.push_back(Pair("amount", ValueFromAmount(s.amount)));
|
||||||
entry.push_back(Pair("vout", s.vout));
|
entry.push_back(Pair("vout", s.vout));
|
||||||
entry.push_back(Pair("fee", ValueFromAmount(nFee)));
|
entry.push_back(Pair("fee", ValueFromAmount(nFee)));
|
||||||
|
entry.push_back(Pair("confirmations", wtx.GetDepthInMainChain()));
|
||||||
|
entry.push_back(Pair("is spent", pwalletMain->IsSpent(wtx.GetHash(), s.vout)));
|
||||||
|
entry.push_back(Pair("is in ncc trie", pnccTrie->haveClaim(sName, wtx.GetHash(), s.vout)));
|
||||||
ret.push_back(entry);
|
ret.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue