From e816a092928d06cffe65c23f447c7ab378858343 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 4 Jun 2016 09:37:38 +0100 Subject: [PATCH] ringct: fix off by 1 in mixin usage --- src/ringct/rctSigs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index e78bec58..351b615d 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -439,14 +439,14 @@ namespace rct { //These functions get keys from blockchain //replace these when connecting blockchain //getKeyFromBlockchain grabs a key from the blockchain at "reference_index" to mix with - //populateFromBlockchain creates a keymatrix with "mixin" columns and one of the columns is inPk + //populateFromBlockchain creates a keymatrix with "mixin" + 1 columns and one of the columns is inPk // the return value are the key matrix, and the index where inPk was put (random). tuple populateFromBlockchain(ctkeyV inPk, int mixin) { int rows = inPk.size(); - ctkeyM rv(mixin, inPk); + ctkeyM rv(mixin + 1, inPk); int index = randXmrAmount(mixin); int i = 0, j = 0; - for (i = 0; i < mixin; i++) { + for (i = 0; i <= mixin; i++) { if (i != index) { for (j = 0; j < rows; j++) { getKeyFromBlockchain(rv[i][j], (size_t)randXmrAmount);