Add caching of incremental witnesses for spendable notes
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <assert.h>
|
||||
#include <ios>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
@@ -544,6 +545,13 @@ template<typename K, typename Pred, typename A> unsigned int GetSerializeSize(co
|
||||
template<typename Stream, typename K, typename Pred, typename A> void Serialize(Stream& os, const std::set<K, Pred, A>& m, int nType, int nVersion);
|
||||
template<typename Stream, typename K, typename Pred, typename A> void Unserialize(Stream& is, std::set<K, Pred, A>& m, int nType, int nVersion);
|
||||
|
||||
/**
|
||||
* list
|
||||
*/
|
||||
template<typename T, typename A> unsigned int GetSerializeSize(const std::list<T, A>& m, int nType, int nVersion);
|
||||
template<typename Stream, typename T, typename A> void Serialize(Stream& os, const std::list<T, A>& m, int nType, int nVersion);
|
||||
template<typename Stream, typename T, typename A> void Unserialize(Stream& is, std::list<T, A>& m, int nType, int nVersion);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -890,6 +898,42 @@ void Unserialize(Stream& is, std::set<K, Pred, A>& m, int nType, int nVersion)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* list
|
||||
*/
|
||||
template<typename T, typename A>
|
||||
unsigned int GetSerializeSize(const std::list<T, A>& l, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = GetSizeOfCompactSize(l.size());
|
||||
for (typename std::list<T, A>::const_iterator it = l.begin(); it != l.end(); ++it)
|
||||
nSize += GetSerializeSize((*it), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T, typename A>
|
||||
void Serialize(Stream& os, const std::list<T, A>& l, int nType, int nVersion)
|
||||
{
|
||||
WriteCompactSize(os, l.size());
|
||||
for (typename std::list<T, A>::const_iterator it = l.begin(); it != l.end(); ++it)
|
||||
Serialize(os, (*it), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T, typename A>
|
||||
void Unserialize(Stream& is, std::list<T, A>& l, int nType, int nVersion)
|
||||
{
|
||||
l.clear();
|
||||
unsigned int nSize = ReadCompactSize(is);
|
||||
typename std::list<T, A>::iterator it = l.begin();
|
||||
for (unsigned int i = 0; i < nSize; i++)
|
||||
{
|
||||
T item;
|
||||
Unserialize(is, item, nType, nVersion);
|
||||
l.push_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Support for ADD_SERIALIZE_METHODS and READWRITE macro
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user