aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-06 19:49:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-22 23:17:31 +0000
commit99d946e6191056f747225d36a2408085624b516e (patch)
tree9b81751a703e40d188c26d035edb34e945e28422 /src/cryptonote_basic
parentringct: save 3 bytes on bulletproof size (diff)
downloadmonero-99d946e6191056f747225d36a2408085624b516e.tar.xz
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/cryptonote_boost_serialization.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h
index e3d0ec18f..6f26d8756 100644
--- a/src/cryptonote_basic/cryptonote_boost_serialization.h
+++ b/src/cryptonote_basic/cryptonote_boost_serialization.h
@@ -45,6 +45,8 @@
#include "ringct/rctTypes.h"
#include "ringct/rctOps.h"
+BOOST_CLASS_VERSION(rct::ecdhTuple, 1)
+
//namespace cryptonote {
namespace boost
{
@@ -248,7 +250,15 @@ namespace boost
inline void serialize(Archive &a, rct::ecdhTuple &x, const boost::serialization::version_type ver)
{
a & x.mask;
- a & x.amount;
+ if (ver < 1)
+ {
+ a & x.amount;
+ return;
+ }
+ crypto::hash8 &amount = (crypto::hash8&)x.amount;
+ if (!Archive::is_saving::value)
+ memset(&x.amount, 0, sizeof(x.amount));
+ a & amount;
// a & x.senderPk; // not serialized, as we do not use it in monero currently
}