diff --git a/src/coins.cpp b/src/coins.cpp index 778602449..8db1600c7 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -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 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()); diff --git a/src/keva/common.cpp b/src/keva/common.cpp index 2e7a4bf79..718d11a4f 100644 --- a/src/keva/common.cpp +++ b/src/keva/common.cpp @@ -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) { diff --git a/src/keva/common.h b/src/keva/common.h index 52df9fdc3..01a8c678a 100644 --- a/src/keva/common.h +++ b/src/keva/common.h @@ -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: 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);