aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-06-29 18:18:18 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:28:55 +0100
commit20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3 (patch)
tree1f18f1130c9c553b7b103d035e6d829ec182011e /src/wallet
parentAdd rct core tests (diff)
downloadmonero-20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3.tar.xz
ringct: do not serialize what can be reconstructed
The mixRing (output keys and commitments) and II fields (key images) can be reconstructed from vin data. This saves some modest amount of space in the tx.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 59472e648..3565945d4 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -3237,16 +3237,19 @@ static size_t estimate_rct_tx_size(int n_inputs, int mixin, int n_outputs)
// rangeSigs
size += (2*64*32+32+64*32) * n_outputs;
- // MG
- size += 32 * (mixin+1) * n_inputs + 32 + 32 * n_inputs;
- // mixRing
- size += 2 * 32 * (mixin+1) * n_inputs;
+
+ // MG - only the last slot of II is saved, the rest can be reconstructed
+ size += 32 * (mixin+1) * n_inputs + 32 + 32 * (/*n_inputs+*/1) ;
+
+ // mixRing - not serialized, can be reconstructed
+ /* size += 2 * 32 * (mixin+1) * n_inputs; */
+
// ecdhInfo
size += 3 * 32 * n_outputs;
// outPk
size += 2 * 32 * n_outputs;
- LOG_PRINT_L2("estimated rct tx size for " << n_inputs << " at mixin " << mixin << " and " << n_outputs << ": " << size);
+ LOG_PRINT_L2("estimated rct tx size for " << n_inputs << " at mixin " << mixin << " and " << n_outputs << ": " << size << " (" << (32 * n_inputs + 2 * 32 * (mixin+1) * n_inputs) << " saved)");
return size;
}