From 20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 29 Jun 2016 18:18:18 +0100 Subject: 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. --- src/wallet/wallet2.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/wallet/wallet2.cpp') 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; } -- cgit v1.2.3