diff options
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | src/bench/prevector.cpp | 28 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/interfaces/wallet.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 4 |
5 files changed, 35 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 19e7174475..d8216bc00d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ env: global: - MAKEJOBS=-j3 - RUN_TESTS=false + - DOCKER_NAME_TAG=ubuntu:18.04 - BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID - CCACHE_SIZE=100M - CCACHE_TEMPDIR=/tmp/.ccache-temp @@ -45,9 +46,10 @@ env: before_install: - export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") install: + - travis_retry docker pull $DOCKER_NAME_TAG - env | grep -E '^(CCACHE_|WINEDEBUG|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env - if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN"; fi - - DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$TRAVIS_BUILD_DIR,dst=$TRAVIS_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $TRAVIS_BUILD_DIR --env-file /tmp/env ubuntu:18.04) + - DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$TRAVIS_BUILD_DIR,dst=$TRAVIS_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $TRAVIS_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) - DOCKER_EXEC () { docker exec $DOCKER_ID bash -c "cd $PWD && $*"; } - if [ -n "$DPKG_ADD_ARCH" ]; then DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi - travis_retry DOCKER_EXEC apt-get update 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; } |