diff --git a/qa/zcash/performance-measurements.sh b/qa/zcash/performance-measurements.sh index b65974078..851adef09 100755 --- a/qa/zcash/performance-measurements.sh +++ b/qa/zcash/performance-measurements.sh @@ -56,7 +56,7 @@ function zcashd_valgrind_stop { case "$1" in *) case "$2" in - verifyjoinsplit|trydecryptnotes) + verifyjoinsplit) zcashd_start RAWJOINSPLIT=$(zcash_rpc zcsamplejoinsplit) zcashd_stop @@ -89,7 +89,7 @@ case "$1" in zcash_rpc zcbenchmark validatelargetx 5 ;; trydecryptnotes) - zcash_rpc zcbenchmark trydecryptnotes 1000 "\"$RAWJOINSPLIT\"" + zcash_rpc zcbenchmark trydecryptnotes 1000 "${@:3}" ;; incnotewitnesses) zcash_rpc zcbenchmark incnotewitnesses 100 "${@:3}" @@ -123,7 +123,7 @@ case "$1" in zcash_rpc zcbenchmark verifyequihash 1 ;; trydecryptnotes) - zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\"" + zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}" ;; incnotewitnesses) zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}" @@ -158,7 +158,7 @@ case "$1" in zcash_rpc zcbenchmark verifyequihash 1 ;; trydecryptnotes) - zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\"" + zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}" ;; incnotewitnesses) zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}" diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6c1ce2d11..abd8a362e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2454,8 +2454,7 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp) JSDescription samplejoinsplit; - if (benchmarktype == "verifyjoinsplit" || - benchmarktype == "trydecryptnotes") { + if (benchmarktype == "verifyjoinsplit") { CDataStream ss(ParseHexV(params[2].get_str(), "js"), SER_NETWORK, PROTOCOL_VERSION); ss >> samplejoinsplit; } @@ -2482,7 +2481,8 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp) } else if (benchmarktype == "validatelargetx") { sample_times.push_back(benchmark_large_tx()); } else if (benchmarktype == "trydecryptnotes") { - sample_times.push_back(benchmark_try_decrypt_notes(samplejoinsplit)); + int nAddrs = params[2].get_int(); + sample_times.push_back(benchmark_try_decrypt_notes(nAddrs)); } else if (benchmarktype == "incnotewitnesses") { int nTxs = params[2].get_int(); sample_times.push_back(benchmark_increment_note_witnesses(nTxs)); diff --git a/src/zcbenchmarks.cpp b/src/zcbenchmarks.cpp index 61afb535d..8f324850b 100644 --- a/src/zcbenchmarks.cpp +++ b/src/zcbenchmarks.cpp @@ -224,19 +224,16 @@ double benchmark_large_tx() return timer_stop(tv_start); } -double benchmark_try_decrypt_notes(const JSDescription &joinsplit) +double benchmark_try_decrypt_notes(size_t nAddrs) { - const size_t NUM_ADDRS = 10; - CWallet wallet; - for (int i = 0; i < NUM_ADDRS; i++) { + for (int i = 0; i < nAddrs; i++) { auto sk = libzcash::SpendingKey::random(); wallet.AddSpendingKey(sk); } - CMutableTransaction mtx; - mtx.vjoinsplit.push_back(joinsplit); - CTransaction tx(mtx); + auto sk = libzcash::SpendingKey::random(); + auto tx = GetValidReceive(*pzcashParams, sk, 10, true); struct timeval tv_start; timer_start(tv_start); diff --git a/src/zcbenchmarks.h b/src/zcbenchmarks.h index a1575e500..318921002 100644 --- a/src/zcbenchmarks.h +++ b/src/zcbenchmarks.h @@ -12,7 +12,7 @@ extern std::vector benchmark_solve_equihash_threaded(int nThreads); extern double benchmark_verify_joinsplit(const JSDescription &joinsplit); extern double benchmark_verify_equihash(); extern double benchmark_large_tx(); -extern double benchmark_try_decrypt_notes(const JSDescription &joinsplit); +extern double benchmark_try_decrypt_notes(size_t nAddrs); extern double benchmark_increment_note_witnesses(size_t nTxs); #endif