aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-06-03 20:10:49 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-06-03 21:30:39 +0200
commitf41d339b781f41f05946e965da3e1bf5d0a9e50b (patch)
tree1c6bc68deb832832678e1d08dbaaa5cf84784637 /src/bench
parente24bf1ce184bc8d5bba70a3f3e9c43c2df07f4d3 (diff)
downloadbitcoin-f41d339b781f41f05946e965da3e1bf5d0a9e50b.tar.xz
bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...)
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/bench_bitcoin.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp
index 556d1fae9e..f3302bfe5a 100644
--- a/src/bench/bench_bitcoin.cpp
+++ b/src/bench/bench_bitcoin.cpp
@@ -6,11 +6,10 @@
#include <crypto/sha256.h>
#include <key.h>
-#include <validation.h>
-#include <util.h>
#include <random.h>
-
-#include <boost/lexical_cast.hpp>
+#include <util.h>
+#include <utilstrencodings.h>
+#include <validation.h>
#include <memory>
@@ -64,8 +63,11 @@ int main(int argc, char** argv)
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
bool is_list_only = gArgs.GetBoolArg("-list", false);
- double scaling_factor = boost::lexical_cast<double>(scaling_str);
-
+ double scaling_factor;
+ if (!ParseDouble(scaling_str, &scaling_factor)) {
+ fprintf(stderr, "Error parsing scaling factor as double: %s\n", scaling_str.c_str());
+ return EXIT_FAILURE;
+ }
std::unique_ptr<benchmark::Printer> printer(new benchmark::ConsolePrinter());
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER);