Generate JS for trydecryptnotes, make number of addresses a variable
This commit is contained in:
@@ -56,7 +56,7 @@ function zcashd_valgrind_stop {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
*)
|
*)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
verifyjoinsplit|trydecryptnotes)
|
verifyjoinsplit)
|
||||||
zcashd_start
|
zcashd_start
|
||||||
RAWJOINSPLIT=$(zcash_rpc zcsamplejoinsplit)
|
RAWJOINSPLIT=$(zcash_rpc zcsamplejoinsplit)
|
||||||
zcashd_stop
|
zcashd_stop
|
||||||
@@ -89,7 +89,7 @@ case "$1" in
|
|||||||
zcash_rpc zcbenchmark validatelargetx 5
|
zcash_rpc zcbenchmark validatelargetx 5
|
||||||
;;
|
;;
|
||||||
trydecryptnotes)
|
trydecryptnotes)
|
||||||
zcash_rpc zcbenchmark trydecryptnotes 1000 "\"$RAWJOINSPLIT\""
|
zcash_rpc zcbenchmark trydecryptnotes 1000 "${@:3}"
|
||||||
;;
|
;;
|
||||||
incnotewitnesses)
|
incnotewitnesses)
|
||||||
zcash_rpc zcbenchmark incnotewitnesses 100 "${@:3}"
|
zcash_rpc zcbenchmark incnotewitnesses 100 "${@:3}"
|
||||||
@@ -123,7 +123,7 @@ case "$1" in
|
|||||||
zcash_rpc zcbenchmark verifyequihash 1
|
zcash_rpc zcbenchmark verifyequihash 1
|
||||||
;;
|
;;
|
||||||
trydecryptnotes)
|
trydecryptnotes)
|
||||||
zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\""
|
zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}"
|
||||||
;;
|
;;
|
||||||
incnotewitnesses)
|
incnotewitnesses)
|
||||||
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"
|
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"
|
||||||
@@ -158,7 +158,7 @@ case "$1" in
|
|||||||
zcash_rpc zcbenchmark verifyequihash 1
|
zcash_rpc zcbenchmark verifyequihash 1
|
||||||
;;
|
;;
|
||||||
trydecryptnotes)
|
trydecryptnotes)
|
||||||
zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\""
|
zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}"
|
||||||
;;
|
;;
|
||||||
incnotewitnesses)
|
incnotewitnesses)
|
||||||
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"
|
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"
|
||||||
|
|||||||
@@ -2454,8 +2454,7 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
|
|||||||
|
|
||||||
JSDescription samplejoinsplit;
|
JSDescription samplejoinsplit;
|
||||||
|
|
||||||
if (benchmarktype == "verifyjoinsplit" ||
|
if (benchmarktype == "verifyjoinsplit") {
|
||||||
benchmarktype == "trydecryptnotes") {
|
|
||||||
CDataStream ss(ParseHexV(params[2].get_str(), "js"), SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ss(ParseHexV(params[2].get_str(), "js"), SER_NETWORK, PROTOCOL_VERSION);
|
||||||
ss >> samplejoinsplit;
|
ss >> samplejoinsplit;
|
||||||
}
|
}
|
||||||
@@ -2482,7 +2481,8 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
|
|||||||
} else if (benchmarktype == "validatelargetx") {
|
} else if (benchmarktype == "validatelargetx") {
|
||||||
sample_times.push_back(benchmark_large_tx());
|
sample_times.push_back(benchmark_large_tx());
|
||||||
} else if (benchmarktype == "trydecryptnotes") {
|
} 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") {
|
} else if (benchmarktype == "incnotewitnesses") {
|
||||||
int nTxs = params[2].get_int();
|
int nTxs = params[2].get_int();
|
||||||
sample_times.push_back(benchmark_increment_note_witnesses(nTxs));
|
sample_times.push_back(benchmark_increment_note_witnesses(nTxs));
|
||||||
|
|||||||
@@ -224,19 +224,16 @@ double benchmark_large_tx()
|
|||||||
return timer_stop(tv_start);
|
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;
|
CWallet wallet;
|
||||||
for (int i = 0; i < NUM_ADDRS; i++) {
|
for (int i = 0; i < nAddrs; i++) {
|
||||||
auto sk = libzcash::SpendingKey::random();
|
auto sk = libzcash::SpendingKey::random();
|
||||||
wallet.AddSpendingKey(sk);
|
wallet.AddSpendingKey(sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
auto sk = libzcash::SpendingKey::random();
|
||||||
mtx.vjoinsplit.push_back(joinsplit);
|
auto tx = GetValidReceive(*pzcashParams, sk, 10, true);
|
||||||
CTransaction tx(mtx);
|
|
||||||
|
|
||||||
struct timeval tv_start;
|
struct timeval tv_start;
|
||||||
timer_start(tv_start);
|
timer_start(tv_start);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ extern std::vector<double> benchmark_solve_equihash_threaded(int nThreads);
|
|||||||
extern double benchmark_verify_joinsplit(const JSDescription &joinsplit);
|
extern double benchmark_verify_joinsplit(const JSDescription &joinsplit);
|
||||||
extern double benchmark_verify_equihash();
|
extern double benchmark_verify_equihash();
|
||||||
extern double benchmark_large_tx();
|
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);
|
extern double benchmark_increment_note_witnesses(size_t nTxs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user