Auto merge of #2601 - str4d:2156-large-wallet-utxos, r=str4d
Benchmark time to call sendtoaddress with many UTXOs Part of #2156.
This commit is contained in:
@@ -2596,6 +2596,12 @@ UniValue zc_benchmark(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Benchmark must be run in regtest mode");
|
||||
}
|
||||
sample_times.push_back(benchmark_connectblock_slow());
|
||||
} else if (benchmarktype == "sendtoaddress") {
|
||||
if (Params().NetworkIDString() != "regtest") {
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Benchmark must be run in regtest mode");
|
||||
}
|
||||
auto amount = AmountFromValue(params[2]);
|
||||
sample_times.push_back(benchmark_sendtoaddress(amount));
|
||||
} else {
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype");
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
#include "pow.h"
|
||||
#include "rpcserver.h"
|
||||
#include "script/sign.h"
|
||||
#include "sodium.h"
|
||||
#include "streams.h"
|
||||
@@ -405,3 +406,17 @@ double benchmark_connectblock_slow()
|
||||
return duration;
|
||||
}
|
||||
|
||||
double benchmark_sendtoaddress(CAmount amount)
|
||||
{
|
||||
UniValue params(UniValue::VARR);
|
||||
auto addr = getnewaddress(params, false);
|
||||
|
||||
params.push_back(addr);
|
||||
params.push_back(ValueFromAmount(amount));
|
||||
|
||||
struct timeval tv_start;
|
||||
timer_start(tv_start);
|
||||
auto txid = sendtoaddress(params, false);
|
||||
return timer_stop(tv_start);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,6 @@ extern double benchmark_large_tx();
|
||||
extern double benchmark_try_decrypt_notes(size_t nAddrs);
|
||||
extern double benchmark_increment_note_witnesses(size_t nTxs);
|
||||
extern double benchmark_connectblock_slow();
|
||||
extern double benchmark_sendtoaddress(CAmount amount);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user