diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-06 19:49:52 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-12 12:16:45 +0000 |
commit | 6ba3a116377ffdf03e0c3580ef5a0c7c6743f69f (patch) | |
tree | 1202fb01fad655c724be61964570e6259f30918a /src/ringct/rctTypes.h | |
parent | ringct: save 3 bytes on bulletproof size (diff) | |
download | monero-6ba3a116377ffdf03e0c3580ef5a0c7c6743f69f.tar.xz |
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
Diffstat (limited to 'src/ringct/rctTypes.h')
-rw-r--r-- | src/ringct/rctTypes.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index 0a4dad1a0..de026226e 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -282,7 +282,20 @@ namespace rct { return false; for (size_t i = 0; i < outputs; ++i) { - FIELDS(ecdhInfo[i]) + if (type == RCTTypeBulletproof2) + { + ar.begin_object(); + FIELD_N("mask", ecdhInfo[i].mask); + if (!typename Archive<W>::is_saving()) + memset(ecdhInfo[i].amount.bytes, 0, sizeof(ecdhInfo[i].amount.bytes)); + crypto::hash8 &amount = (crypto::hash8&)ecdhInfo[i].amount; + FIELD(amount); + ar.end_object(); + } + else + { + FIELDS(ecdhInfo[i]) + } if (outputs - i > 1) ar.delimit_array(); } |