Browse Source

Stored the latest tx output in namespace data.

cn
Jianping Wu 6 years ago
parent
commit
c72450e983
  1. 10
      src/coins.cpp
  2. 6
      src/keva/common.cpp
  3. 11
      src/keva/common.h

10
src/coins.cpp

@ -200,9 +200,9 @@ CNameIterator* CCoinsViewCache::IterateNames() const { @@ -200,9 +200,9 @@ CNameIterator* CCoinsViewCache::IterateNames() const {
name history. */
void CCoinsViewCache::SetName(const valtype &nameSpace, const valtype &key, const CKevaData& data, bool undo)
{
#if 0
CKevaData oldData;
if (GetName(nameSpace, key, oldData)) {
#if 0
cacheNames.removeExpireIndex(name, oldData.getHeight());
/* Update the name history. If we are undoing, we expect that
@ -228,11 +228,15 @@ void CCoinsViewCache::SetName(const valtype &nameSpace, const valtype &key, cons @@ -228,11 +228,15 @@ void CCoinsViewCache::SetName(const valtype &nameSpace, const valtype &key, cons
cacheNames.setHistory(name, history);
}
#endif
} else {
assert (!undo);
}
#endif
CKevaData namespaceData;
if (GetNamespace(nameSpace, namespaceData)) {
namespaceData.setUpdateOutpoint(data.getUpdateOutpoint());
cacheNames.setNamespace(nameSpace, namespaceData);
}
cacheNames.set(nameSpace, key, data);
#if 0
cacheNames.addExpireIndex(name, data.getHeight());

6
src/keva/common.cpp

@ -200,6 +200,12 @@ CKevaCache::GetNamespace(const valtype& nameSpace, CKevaData& data) const @@ -200,6 +200,12 @@ CKevaCache::GetNamespace(const valtype& nameSpace, CKevaData& data) const
return get(nameSpace, ValtypeFromString(CKevaScript::KEVA_DISPLAY_NAME_KEY), data);
}
void
CKevaCache::setNamespace(const valtype& nameSpace, const CKevaData& data)
{
set(nameSpace, ValtypeFromString(CKevaScript::KEVA_DISPLAY_NAME_KEY), data);
}
void
CKevaCache::set(const valtype& nameSpace, const valtype& key, const CKevaData& data)
{

11
src/keva/common.h

@ -130,6 +130,15 @@ public: @@ -130,6 +130,15 @@ public:
return prevout;
}
/**
* Get the namespace's updated outpoint.
*/
inline void
setUpdateOutpoint (const COutPoint& out)
{
prevout = out;
}
/**
* Get the address.
* @return The name's address.
@ -458,6 +467,8 @@ public: @@ -458,6 +467,8 @@ public:
removes the "deleted" mark. */
void set(const valtype& nameSpace, const valtype& key, const CKevaData& data);
void setNamespace(const valtype& nameSpace, const CKevaData& data);
/* Delete a name. If it is in the "entries" set also, remove it there. */
void remove(const valtype& nameSpace, const valtype& key);

Loading…
Cancel
Save