aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bench/prevector.cpp28
-rw-r--r--src/init.cpp2
-rw-r--r--src/interfaces/wallet.cpp2
-rw-r--r--src/wallet/wallet.cpp4
4 files changed, 32 insertions, 4 deletions
diff --git a/src/bench/prevector.cpp b/src/bench/prevector.cpp
index 09c7020848..7986d0da79 100644
--- a/src/bench/prevector.cpp
+++ b/src/bench/prevector.cpp
@@ -4,12 +4,17 @@
#include <compat.h>
#include <prevector.h>
+#include <serialize.h>
+#include <streams.h>
#include <bench/bench.h>
struct nontrivial_t {
int x;
nontrivial_t() :x(-1) {}
+ ADD_SERIALIZE_METHODS
+ template <typename Stream, typename Operation>
+ inline void SerializationOp(Stream& s, Operation ser_action) {READWRITE(x);}
};
static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value,
"expected nontrivial_t to not be trivially constructible");
@@ -62,6 +67,28 @@ static void PrevectorResize(benchmark::State& state)
}
}
+template <typename T>
+static void PrevectorDeserialize(benchmark::State& state)
+{
+ CDataStream s0(SER_NETWORK, 0);
+ prevector<28, T> t0;
+ t0.resize(28);
+ for (auto x = 0; x < 900; ++x) {
+ s0 << t0;
+ }
+ t0.resize(100);
+ for (auto x = 0; x < 101; ++x) {
+ s0 << t0;
+ }
+ while (state.KeepRunning()) {
+ prevector<28, T> t1;
+ for (auto x = 0; x < 1000; ++x) {
+ s0 >> t1;
+ }
+ s0.Init(SER_NETWORK, 0);
+ }
+}
+
#define PREVECTOR_TEST(name, nontrivops, trivops) \
static void Prevector ## name ## Nontrivial(benchmark::State& state) { \
Prevector ## name<nontrivial_t>(state); \
@@ -75,3 +102,4 @@ static void PrevectorResize(benchmark::State& state)
PREVECTOR_TEST(Clear, 28300, 88600)
PREVECTOR_TEST(Destructor, 28800, 88900)
PREVECTOR_TEST(Resize, 28900, 90300)
+PREVECTOR_TEST(Deserialize, 6800, 52000)
diff --git a/src/init.cpp b/src/init.cpp
index 36b094df07..18402ef5d7 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -925,7 +925,7 @@ bool AppInitParameterInteraction()
// also see: InitParameterInteraction()
if (!fs::is_directory(GetBlocksDir(false))) {
- return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist.\n"), gArgs.GetArg("-blocksdir", "").c_str()));
+ return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist."), gArgs.GetArg("-blocksdir", "").c_str()));
}
// if using block pruning, then disallow txindex
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp
index 28081c7c2c..55a6f771e5 100644
--- a/src/interfaces/wallet.cpp
+++ b/src/interfaces/wallet.cpp
@@ -90,7 +90,7 @@ WalletTxStatus MakeWalletTxStatus(const CWalletTx& wtx)
WalletTxStatus result;
auto mi = ::mapBlockIndex.find(wtx.hashBlock);
CBlockIndex* block = mi != ::mapBlockIndex.end() ? mi->second : nullptr;
- result.block_height = (block ? block->nHeight : std::numeric_limits<int>::max()),
+ result.block_height = (block ? block->nHeight : std::numeric_limits<int>::max());
result.blocks_to_maturity = wtx.GetBlocksToMaturity();
result.depth_in_main_chain = wtx.GetDepthInMainChain();
result.time_received = wtx.nTimeReceived;
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 15139c9817..4918100b30 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4095,7 +4095,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name,
// Regenerate the keypool if upgraded to HD
if (hd_upgrade) {
if (!walletInstance->TopUpKeyPool()) {
- InitError(_("Unable to generate keys") += "\n");
+ InitError(_("Unable to generate keys"));
return nullptr;
}
}
@@ -4121,7 +4121,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name,
// Top up the keypool
if (!walletInstance->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) && !walletInstance->TopUpKeyPool()) {
- InitError(_("Unable to generate initial keys") += "\n");
+ InitError(_("Unable to generate initial keys"));
return nullptr;
}