aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bench/rpc_blockchain.cpp48
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/rpc/misc.cpp4
-rw-r--r--src/wallet/rpcwallet.cpp2
4 files changed, 39 insertions, 17 deletions
diff --git a/src/bench/rpc_blockchain.cpp b/src/bench/rpc_blockchain.cpp
index 45ed9f60dc..78f8c6e6dc 100644
--- a/src/bench/rpc_blockchain.cpp
+++ b/src/bench/rpc_blockchain.cpp
@@ -12,25 +12,49 @@
#include <univalue.h>
-static void BlockToJsonVerbose(benchmark::Bench& bench)
-{
+namespace {
+
+struct TestBlockAndIndex {
TestingSetup test_setup{};
+ CBlock block{};
+ uint256 blockHash{};
+ CBlockIndex blockindex{};
- CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
- char a = '\0';
- stream.write(&a, 1); // Prevent compaction
+ TestBlockAndIndex()
+ {
+ CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION);
+ char a = '\0';
+ stream.write(&a, 1); // Prevent compaction
- CBlock block;
- stream >> block;
+ stream >> block;
- CBlockIndex blockindex;
- const uint256 blockHash = block.GetHash();
- blockindex.phashBlock = &blockHash;
- blockindex.nBits = 403014710;
+ blockHash = block.GetHash();
+ blockindex.phashBlock = &blockHash;
+ blockindex.nBits = 403014710;
+ }
+};
+} // namespace
+
+static void BlockToJsonVerbose(benchmark::Bench& bench)
+{
+ TestBlockAndIndex data;
bench.run([&] {
- (void)blockToJSON(block, &blockindex, &blockindex, /*verbose*/ true);
+ auto univalue = blockToJSON(data.block, &data.blockindex, &data.blockindex, /*verbose*/ true);
+ ankerl::nanobench::doNotOptimizeAway(univalue);
});
}
BENCHMARK(BlockToJsonVerbose);
+
+static void BlockToJsonVerboseWrite(benchmark::Bench& bench)
+{
+ TestBlockAndIndex data;
+ auto univalue = blockToJSON(data.block, &data.blockindex, &data.blockindex, /*verbose*/ true);
+ bench.run([&] {
+ auto str = univalue.write();
+ ankerl::nanobench::doNotOptimizeAway(str);
+ });
+}
+
+BENCHMARK(BlockToJsonVerboseWrite);
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index bad74fcbcc..ef2f56c2c0 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -464,9 +464,7 @@ int GuiMain(int argc, char* argv[])
// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
-#if QT_VERSION >= 0x050600
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-#endif
#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 8)) && defined(Q_OS_MACOS)
const auto os_name = QSysInfo::prettyProductName();
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 38a0bddddb..143be1274e 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -305,11 +305,11 @@ static RPCHelpMan verifymessage()
switch (MessageVerify(strAddress, strSign, strMessage)) {
case MessageVerificationResult::ERR_INVALID_ADDRESS:
- throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
case MessageVerificationResult::ERR_ADDRESS_NO_KEY:
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key");
case MessageVerificationResult::ERR_MALFORMED_SIGNATURE:
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
+ throw JSONRPCError(RPC_TYPE_ERROR, "Malformed base64 encoding");
case MessageVerificationResult::ERR_PUBKEY_NOT_RECOVERED:
case MessageVerificationResult::ERR_NOT_SIGNED:
return false;
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index bfc42ac1b0..6d6cdedb2b 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -630,7 +630,7 @@ static RPCHelpMan signmessage()
CTxDestination dest = DecodeDestination(strAddress);
if (!IsValidDestination(dest)) {
- throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
}
const PKHash* pkhash = std::get_if<PKHash>(&dest);