aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rwxr-xr-x.travis/test_04_install.sh3
-rwxr-xr-x.travis/test_06_script.sh3
-rw-r--r--doc/build-windows.md10
-rw-r--r--src/qt/macnotificationhandler.mm23
-rw-r--r--src/wallet/test/wallet_tests.cpp55
-rw-r--r--src/wallet/wallet.cpp1
-rw-r--r--test/sanitizer_suppressions/tsan14
8 files changed, 78 insertions, 35 deletions
diff --git a/.travis.yml b/.travis.yml
index d051f37d98..a7c6e03f2d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -99,9 +99,9 @@ jobs:
DOCKER_NAME_TAG=ubuntu:16.04
PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
NO_DEPENDS=1
- RUN_FUNCTIONAL_TESTS=false # Disabled for now. TODO identify suppressions or exclude specific tests
+ FUNCTIONAL_TESTS_CONFIG="--exclude feature_block.py,p2p_invalid_messages.py"
GOAL="install"
- BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread --disable-hardening --disable-asm CC=clang CXX=clang++"
+ BITCOIN_CONFIG="--enable-zmq --disable-wallet --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread --disable-hardening --disable-asm CC=clang CXX=clang++"
# x86_64 Linux (no depends, only system libs, sanitizers: address/leak (ASan + LSan) + undefined (UBSan) + integer)
- stage: test
env: >-
diff --git a/.travis/test_04_install.sh b/.travis/test_04_install.sh
index 03a61ea9f8..3f74158117 100755
--- a/.travis/test_04_install.sh
+++ b/.travis/test_04_install.sh
@@ -7,9 +7,10 @@
export LC_ALL=C.UTF-8
travis_retry docker pull "$DOCKER_NAME_TAG"
+mkdir -p "${TRAVIS_BUILD_DIR}/sanitizer-output/"
export ASAN_OPTIONS=""
export LSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/lsan"
-export TSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/tsan"
+export TSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/tsan:log_path=${TRAVIS_BUILD_DIR}/sanitizer-output/tsan"
export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1"
env | grep -E '^(BITCOIN_CONFIG|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
if [[ $HOST = *-mingw32 ]]; then
diff --git a/.travis/test_06_script.sh b/.travis/test_06_script.sh
index 506d2b518c..618aa2c3b6 100755
--- a/.travis/test_06_script.sh
+++ b/.travis/test_06_script.sh
@@ -40,6 +40,9 @@ BEGIN_FOLD configure
DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
END_FOLD
+set -o errtrace
+trap 'DOCKER_EXEC "cat ${TRAVIS_BUILD_DIR}/sanitizer-output/* 2> /dev/null"' ERR
+
BEGIN_FOLD build
DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
END_FOLD
diff --git a/doc/build-windows.md b/doc/build-windows.md
index fc93a0c6e4..9641e0d3fd 100644
--- a/doc/build-windows.md
+++ b/doc/build-windows.md
@@ -65,7 +65,11 @@ A host toolchain (`build-essential`) is necessary because some dependency
packages (such as `protobuf`) need to build host utilities that are used in the
build process.
-See also: [dependencies.md](dependencies.md).
+See [dependencies.md](dependencies.md) for a complete overview.
+
+If you want to build the windows installer with `make deploy` you need [NSIS](https://nsis.sourceforge.io/Main_Page):
+
+ sudo apt install nsis
## Building for 64-bit Windows
@@ -139,6 +143,10 @@ way. This will install to `c:\workspace\bitcoin`, for example:
make install DESTDIR=/mnt/c/workspace/bitcoin
+You can also create an installer using:
+
+ make deploy
+
Footnotes
---------
diff --git a/src/qt/macnotificationhandler.mm b/src/qt/macnotificationhandler.mm
index 0e04d50baa..a07079eece 100644
--- a/src/qt/macnotificationhandler.mm
+++ b/src/qt/macnotificationhandler.mm
@@ -24,25 +24,10 @@ void MacNotificationHandler::showNotification(const QString &title, const QStrin
{
// check if users OS has support for NSUserNotification
if(this->hasUserNotificationCenterSupport()) {
- // okay, seems like 10.8+
- QByteArray utf8 = title.toUtf8();
- char* cString = (char *)utf8.constData();
- NSString *titleMac = [[NSString alloc] initWithUTF8String:cString];
-
- utf8 = text.toUtf8();
- cString = (char *)utf8.constData();
- NSString *textMac = [[NSString alloc] initWithUTF8String:cString];
-
- // do everything weak linked (because we will keep <10.8 compatibility)
- id userNotification = [[NSClassFromString(@"NSUserNotification") alloc] init];
- [userNotification performSelector:@selector(setTitle:) withObject:titleMac];
- [userNotification performSelector:@selector(setInformativeText:) withObject:textMac];
-
- id notificationCenterInstance = [NSClassFromString(@"NSUserNotificationCenter") performSelector:@selector(defaultUserNotificationCenter)];
- [notificationCenterInstance performSelector:@selector(deliverNotification:) withObject:userNotification];
-
- [titleMac release];
- [textMac release];
+ NSUserNotification* userNotification = [[NSUserNotification alloc] init];
+ userNotification.title = title.toNSString();
+ userNotification.informativeText = text.toNSString();
+ [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: userNotification];
[userNotification release];
}
}
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index 5731a27e00..1ed1926af2 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -34,7 +34,7 @@ static void AddKey(CWallet& wallet, const CKey& key)
wallet.AddKeyPubKey(key, key.GetPubKey());
}
-BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
+BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
{
auto chain = interfaces::MakeChain();
@@ -47,6 +47,19 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
auto locked_chain = chain->lock();
+ // Verify ScanForWalletTransactions accomodates a null start block.
+ {
+ CWallet wallet(*chain, WalletLocation(), WalletDatabase::CreateDummy());
+ AddKey(wallet, coinbaseKey);
+ WalletRescanReserver reserver(&wallet);
+ reserver.reserve();
+ const CBlockIndex *stop_block = null_block + 1, *failed_block = null_block + 1;
+ BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(nullptr, nullptr, reserver, failed_block, stop_block), CWallet::ScanResult::SUCCESS);
+ BOOST_CHECK_EQUAL(failed_block, null_block);
+ BOOST_CHECK_EQUAL(stop_block, null_block);
+ BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 0);
+ }
+
// Verify ScanForWalletTransactions picks up transactions in both the old
// and new block files.
{
@@ -54,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
AddKey(wallet, coinbaseKey);
WalletRescanReserver reserver(&wallet);
reserver.reserve();
- const CBlockIndex *stop_block, *failed_block;
+ const CBlockIndex *stop_block = null_block + 1, *failed_block = null_block + 1;
BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(oldTip, nullptr, reserver, failed_block, stop_block), CWallet::ScanResult::SUCCESS);
BOOST_CHECK_EQUAL(failed_block, null_block);
BOOST_CHECK_EQUAL(stop_block, newTip);
@@ -72,13 +85,47 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
AddKey(wallet, coinbaseKey);
WalletRescanReserver reserver(&wallet);
reserver.reserve();
- const CBlockIndex *stop_block, *failed_block;
+ const CBlockIndex *stop_block = null_block + 1, *failed_block = null_block + 1;
BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(oldTip, nullptr, reserver, failed_block, stop_block), CWallet::ScanResult::FAILURE);
BOOST_CHECK_EQUAL(failed_block, oldTip);
BOOST_CHECK_EQUAL(stop_block, newTip);
BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 50 * COIN);
}
+ // Prune the remaining block file.
+ PruneOneBlockFile(newTip->GetBlockPos().nFile);
+ UnlinkPrunedFiles({newTip->GetBlockPos().nFile});
+
+ // Verify ScanForWalletTransactions scans no blocks.
+ {
+ CWallet wallet(*chain, WalletLocation(), WalletDatabase::CreateDummy());
+ AddKey(wallet, coinbaseKey);
+ WalletRescanReserver reserver(&wallet);
+ reserver.reserve();
+ const CBlockIndex *stop_block = null_block + 1, *failed_block = null_block + 1;
+ BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(oldTip, nullptr, reserver, failed_block, stop_block), CWallet::ScanResult::FAILURE);
+ BOOST_CHECK_EQUAL(failed_block, newTip);
+ BOOST_CHECK_EQUAL(stop_block, null_block);
+ BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 0);
+ }
+}
+
+BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
+{
+ auto chain = interfaces::MakeChain();
+
+ // Cap last block file size, and mine new block in a new block file.
+ CBlockIndex* oldTip = chainActive.Tip();
+ GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE;
+ CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
+ CBlockIndex* newTip = chainActive.Tip();
+
+ auto locked_chain = chain->lock();
+
+ // Prune the older block file.
+ PruneOneBlockFile(oldTip->GetBlockPos().nFile);
+ UnlinkPrunedFiles({oldTip->GetBlockPos().nFile});
+
// Verify importmulti RPC returns failure for a key whose creation time is
// before the missing block, and success for a key whose creation time is
// after.
@@ -294,7 +341,7 @@ public:
WalletRescanReserver reserver(wallet.get());
reserver.reserve();
const CBlockIndex* const null_block = nullptr;
- const CBlockIndex *stop_block, *failed_block;
+ const CBlockIndex *stop_block = null_block + 1, *failed_block = null_block + 1;
BOOST_CHECK_EQUAL(wallet->ScanForWalletTransactions(chainActive.Genesis(), nullptr, reserver, failed_block, stop_block), CWallet::ScanResult::SUCCESS);
BOOST_CHECK_EQUAL(stop_block, chainActive.Tip());
BOOST_CHECK_EQUAL(failed_block, null_block);
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index fea0378839..109f8e6da0 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1601,6 +1601,7 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const CBlockIndex* const
const CBlockIndex* pindex = pindexStart;
failed_block = nullptr;
+ stop_block = nullptr;
if (pindex) WalletLogPrintf("Rescan started from block %d...\n", pindex->nHeight);
diff --git a/test/sanitizer_suppressions/tsan b/test/sanitizer_suppressions/tsan
index 996f342eb9..593e1f54ff 100644
--- a/test/sanitizer_suppressions/tsan
+++ b/test/sanitizer_suppressions/tsan
@@ -7,15 +7,13 @@ deadlock:WalletBatch
# Intentional deadlock in tests
deadlock:TestPotentialDeadLockDetected
+# fRPCRunning race
+race:InterruptRPC
+
# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
race:src/qt/test/*
deadlock:src/qt/test/*
-# WIP: Unidentified suppressions to run the functional tests
-#race:zmqpublishnotifier.cpp
-#
-#deadlock:CreateWalletFromFile
-#deadlock:importprivkey
-#deadlock:walletdb.h
-#deadlock:walletdb.cpp
-#deadlock:wallet/db.cpp
+# External libraries
+deadlock:libdb
+race:libzmq