// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2011 The Bitcoin developers
+// Copyright (c) 2012 The PPCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_SERIALIZE_H
static const char* pszSubVer = "";
static const bool VERSION_IS_BETA = true;
+static const int PPCOIN_VERSION = 100;
+
// Used to bypass the rule against non-const reference to temporary
// where it makes sense with wrappers such as CFlatData or CTxDB
template<typename T>
-
-
+#ifndef THROW_WITH_STACKTRACE
+#define THROW_WITH_STACKTRACE(exception) \
+{ \
+ LogStackTrace(); \
+ throw (exception); \
+}
+void LogStackTrace();
+#endif
//
// Compact size
nSizeRet = xSize;
}
if (nSizeRet > (uint64)MAX_SIZE)
- throw std::ios_base::failure("ReadCompactSize() : size too large");
+ THROW_WITH_STACKTRACE(std::ios_base::failure("ReadCompactSize() : size too large"));
return nSizeRet;
}
void Unserialize(Stream& s, int, int=0)
{
if (pstr == NULL)
- throw std::ios_base::failure("CFixedFieldString::Unserialize : trying to unserialize to const string");
+ THROW_WITH_STACKTRACE(std::ios_base::failure("CFixedFieldString::Unserialize : trying to unserialize to const string"));
char pszBuf[LEN+1];
s.read(pszBuf, LEN);
pszBuf[LEN] = '\0';
{
state |= bits;
if (state & exceptmask)
- throw std::ios_base::failure(psz);
+ THROW_WITH_STACKTRACE(std::ios_base::failure(psz));
}
bool eof() const { return size() == 0; }
{
state |= bits;
if (state & exceptmask)
- throw std::ios_base::failure(psz);
+ THROW_WITH_STACKTRACE(std::ios_base::failure(psz));
}
bool fail() const { return state & (std::ios::badbit | std::ios::failbit); }