Skip to content

Commit

Permalink
Fix wallet transaction serialisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
domob1812 committed Sep 26, 2014
1 parent a57b8bc commit 5edb534
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions include/coinWallet/WalletDB.h
Expand Up @@ -31,19 +31,19 @@ inline CDataStream& operator<<(CDataStream& os, const std::pair<std::string, uin

inline CDataStream& operator>>(CDataStream& is, std::pair<std::string, uint256>& obj) {
std::istringstream iss(is.str());
std::streampos p = iss.tellg();
const std::streampos before = iss.tellg();
iss >> varstr(obj.first) >> obj.second;
p -= iss.tellg();
is.ignore(p);
const std::streampos after = iss.tellg();
is.ignore(after - before);
return is;
}

inline CDataStream& operator>>(CDataStream& is, uint256& n) {
std::istringstream iss(is.str());
std::streampos p = iss.tellg();
const std::streampos before = iss.tellg();
iss >> n;
p -= iss.tellg();
is.ignore(p);
const std::streampos after = iss.tellg();
is.ignore(after - before);
return is;
}

Expand Down
16 changes: 8 additions & 8 deletions include/coinWallet/WalletTx.h
Expand Up @@ -32,18 +32,18 @@ template<typename Stream>
inline unsigned int SerReadWrite(Stream& s, const MerkleTx& obj, int nType, int nVersion, CSerActionSerialize ser_action)
{
std::string str = serialize(obj);
s.write(&s[0], s.size());
s.write(&str[0], str.size());
return 0;
}

template<typename Stream>
inline unsigned int SerReadWrite(Stream& s, MerkleTx& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
{
std::istringstream is(s.str());
std::streampos p = is.tellg();
const std::streampos before = is.tellg();
is >> obj;
p -= is.tellg();
s.ignore(p);
const std::streampos after = is.tellg();
s.ignore(after - before);
// ::Unserialize(s, obj, nType, nVersion);
return 0;
}
Expand All @@ -59,18 +59,18 @@ template<typename Stream>
inline unsigned int SerReadWrite(Stream& s, const std::vector<MerkleTx>& obj, int nType, int nVersion, CSerActionSerialize ser_action)
{
std::string str = serialize(obj);
s.write(&s[0], s.size());
s.write(&str[0], str.size());
return 0;
}

template<typename Stream>
inline unsigned int SerReadWrite(Stream& s, std::vector<MerkleTx>& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
{
std::istringstream is(s.str());
std::streampos p = is.tellg();
const std::streampos before = is.tellg();
is >> obj;
p -= is.tellg();
s.ignore(p);
const std::streampos after = is.tellg();
s.ignore(after - before);
// ::Unserialize(s, obj, nType, nVersion);
return 0;
}
Expand Down

0 comments on commit 5edb534

Please sign in to comment.