From dbf017a5f7bfda96346dfcfdc5b5d0145d5f10e2 Mon Sep 17 00:00:00 2001 From: luigi1111 Date: Thu, 1 Sep 2016 13:14:31 -0500 Subject: [PATCH 1/2] Fix some rct tx size calculations Some variance is still expected --- src/wallet/wallet2.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c6e2411b..be351d5c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3105,27 +3105,24 @@ static size_t estimate_rct_tx_size(int n_inputs, int mixin, int n_outputs) // rct signatures - // simple + // type size += 1; - // message - size += 32; - // rangeSigs - size += (2*64*32+32+64*32) * n_outputs; + size += (2*64*32+64*32) * n_outputs; // MGs - only the last slot of II is saved, the rest can be reconstructed - size += n_inputs * (32 * (mixin+1) * n_inputs + 32 + 32 * (/*n_inputs+*/1)); + size += n_inputs * (32 * (mixin+1) + 32); // mixRing - not serialized, can be reconstructed /* size += 2 * 32 * (mixin+1) * n_inputs; */ // pseudoOuts - size += 32 * n_outputs; + size += 32 * n_inputs; // ecdhInfo - size += 3 * 32 * n_outputs; + size += 2 * 32 * n_outputs; // outPk - only commitment is saved - size += 1 * 32 * n_outputs; + size += 32 * n_outputs; // txnFee size += 4; From 34bb78956f04d5fe8af956fd85d74b89da258e8b Mon Sep 17 00:00:00 2001 From: luigi1111 Date: Thu, 1 Sep 2016 13:53:53 -0500 Subject: [PATCH 2/2] Re-add s to rangesigs Whoops. --- src/wallet/wallet2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index be351d5c..a195abde 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3109,9 +3109,9 @@ static size_t estimate_rct_tx_size(int n_inputs, int mixin, int n_outputs) size += 1; // rangeSigs - size += (2*64*32+64*32) * n_outputs; + size += (2*64*32+32+64*32) * n_outputs; - // MGs - only the last slot of II is saved, the rest can be reconstructed + // MGs size += n_inputs * (32 * (mixin+1) + 32); // mixRing - not serialized, can be reconstructed