aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/wallettests.cpp
AgeCommit message (Collapse)Author
2018-04-05Merge #12859: Bugfix: Include <memory> for std::unique_ptrWladimir J. van der Laan
a5bca13 Bugfix: Include <memory> for std::unique_ptr (Luke Dashjr) Pull request description: Not sure why all these includes were missing, but it's breaking builds for some users: https://bugs.gentoo.org/show_bug.cgi?id=652142 (Added to all files with a reference to `std::unique_ptr`) Tree-SHA512: 8a2c67513ca07b9bb52c34e8a20b15e56f8af2530310d9ee9b0a69694dd05e02e7a3683f14101a2685d457672b56addec591a0bb83900a0eb8e2a43d43200509
2018-04-02Bugfix: Include <memory> for std::unique_ptrLuke Dashjr
2018-03-17wallet: Change output type globals to membersMarcoFalke
2018-03-07Merge #11687: External wallet filesWladimir J. van der Laan
be8ab7d08 Create new wallet databases as directories rather than files (Russell Yanofsky) 26c06f24e Allow wallet files not in -walletdir directory (Russell Yanofsky) d8a99f65e Allow wallet files in multiple directories (Russell Yanofsky) Pull request description: This change consists of three commits: * The first commit is a pure refactoring that removes the restriction that two wallets can only be opened at the same time if they are contained in the same directory. * The second commit removes the restriction that `-wallet` filenames can only refer to files in the `-walletdir` directory. * The third commit makes second commit a little safer by changing bitcoin to create wallet databases as directories rather than files, so they can be safely backed up. All three commits should be straightforward: * The first commit adds around 20 lines of new code and then updates a bunch of function signatures (generally updating them to take plain fs::path parameters, instead of combinations of strings, fs::paths, and objects like CDBEnv and CWalletDBWrapper). * The second commit removes two `-wallet` filename checks and adds some test cases to the multiwallet unit test. * The third commit just changes the mapping from specified wallet paths to bdb environment & data paths. --- **Note:** For anybody looking at this PR for the first time, I think you can skip the comments before _20 Nov_ and start reading at https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-345625565. Comments before _20 Nov_ were about an earlier version of the PR that didn't include the third commit, and then confusion from not seeing the first commit. Tree-SHA512: 00bbb120fe0df847cf57014f75f1f7f1f58b0b62fa0b3adab4560163ebdfe06ccdfff33b4231693f03c5dc23601cb41954a07bcea9a4919c8d42f7d62bcf6024
2018-03-03Allow wallet files in multiple directoriesRussell Yanofsky
Remove requirement that two wallet files can only be opened at the same time if they are contained in the same directory. This change mostly consists of updates to function signatures (updating functions to take fs::path arguments, instead of combinations of strings, fs::path, and CDBEnv / CWalletDBWrapper arguments).
2018-03-02Fix ListCoins test failure due to unset g_wallet_allow_fallback_feeRussell Yanofsky
New global variables were introduced in #11882 and not setting them causes: wallet/test/wallet_tests.cpp(638): error in "ListCoins": check wallet->CreateTransaction({recipient}, wtx, reservekey, fee, changePos, error, dummy) failed wallet/test/wallet_tests.cpp(679): error in "ListCoins": check list.begin()->second.size() == 2 failed [1 != 2] wallet/test/wallet_tests.cpp(686): error in "ListCoins": check available.size() == 2 failed [1 != 2] wallet/test/wallet_tests.cpp(705): error in "ListCoins": check list.begin()->second.size() == 2 failed [1 != 2] It's possible to reproduce the failure reliably by running: src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ListCoins Failures happen nondeterministically because boost test framework doesn't run tests in a specified order, and tests that run previously can set the global variables and mask the bug.
2018-02-25Disable wallet fallbackfee by default on mainnetJonas Schnelli
2018-02-19Split key_io (address/key encodings) off from base58Pieter Wuille
2018-01-23Make sure WalletRescanReserver has successfully reserved the rescanJonas Schnelli
2018-01-09SegWit wallet supportPieter Wuille
This introduces two command line flags (-addresstype and -changetype) which control the type of addresses/outputs created by the GUI and RPCs. Certain RPCs allow overriding these (`getnewaddress` and `getrawchangeaddress`). Supported types are "legacy" (P2PKH and P2SH-multisig), "p2sh-segwit" (P2SH-P2WPKH and P2SH-P2WSH-multisig), and "bech32" (P2WPKH and P2WSH-multisig). A few utility functions are added to the wallet to construct different address type and to add the necessary entries to the wallet file to be compatible with earlier versions (see `CWallet::LearnRelatedScripts`, `GetDestinationForKey`, `GetAllDestinationsForKey`, `CWallet::AddAndGetDestinationForScript`).
2017-11-16scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider
-BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
2017-11-10tests: Add missing locks to testspracticalswift
Add missing locks to tests to satisfy lock requirements (such as EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis), AssertLockHeld(...) and implicit lock assumptions).
2017-10-13Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>"Jonas Schnelli
7a91ceb5e [QA] Add RPC based rescan test (Jonas Schnelli) c77170fbd [Wallet] add rescanblockchain <start_height> <stop_height> RPC command (Jonas Schnelli) Pull request description: A RPC rescan command is much more flexible for the following reasons: * You can define the start and end-height * It can be called during runtime * It can work in multiwallet environment Tree-SHA512: df67177bad6ad1d08e5a621f095564524fa3eb87204c2048ef7265e77013e4b1b29f991708f807002329a507a254f35e79a4ed28a2d18d4b3da7a75d57ce0ea5
2017-10-12[Wallet] add rescanblockchain <start_height> <stop_height> RPC commandJonas Schnelli
2017-09-19[Tests] Add Qt GUI tests to Overview and ReceiveCoin PageAnditto Heristyo
2017-09-06Introduce wrappers around CBitcoinAddressPieter Wuille
This patch removes the need for the intermediary Base58 type CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination function that directly operate on the conversion between strings and CTxDestination.
2017-06-01Fix bumpfee test after #10449Russell Yanofsky
Failure reported by Jorge Timón <jtimon@jtimon.cc> https://github.com/bitcoin/bitcoin/pull/10449#issuecomment-305556569
2017-05-25Fix broken q4 test buildRussell Yanofsky
Error reported by Patrick Strateman <patrick.strateman@gmail.com> https://github.com/bitcoin/bitcoin/pull/10420#issuecomment-303908782
2017-05-23Add Qt tests for wallet spends & bumpfeeRussell Yanofsky
A few code changes were needed to accompany the test: * Adding setObjectName() calls for a few Qt controls to make them easily accessible from the test. * Calling contextMenu->popup() instead of contextMenu->exec() to open the transaction list context menu without blocking the test thread. * Opening the context menu at the contextualMenu event point rather than the cursor position (this change was not strictly needed to make the test work, but is more correct). * Updating the bumped transaction row with showTransaction=true instead of false. This is needed to prevent the bumped tx from being hidden, so the last part of the test which attempts to bump the bumped tx can work. (Technically this change is a more general bugfix not limited to the testing environment, but the bug doesn't happen outside of the testing environment because in the full Qt client, a queued NotifyTransactionChanged notification causes the row to be updated twice, first with showTransaction=false, then immediately after with showTransaction=true.)
2017-05-17[test] Move some tests from qt -> walletRussell Yanofsky
After previous refactoring, the tests make more sense here.
2017-05-17[test] Add tests for some walletmodel functionsRussell Yanofsky
Add unit tests for some walletmodel functions that will be refactored & moved in the next commit.
2017-04-20wallet: Introduce database handle wrapperWladimir J. van der Laan
Abstract database handle from explicit strFilename into CWalletDBWrapper. Also move CWallet::Backup to db.cpp - as it deals with representation details this is a database specific operation.
2017-04-03Run bitcoin_test-qt under minimal QPA platformRussell Yanofsky
Fixes broken "make check" reported by Matt Corallo <git@bluematt.me> in https://github.com/bitcoin/bitcoin/issues/10110 Fix was suggested and initially implemented by Cory Fields <cory-nospam-@coryfields.com> in https://github.com/bitcoin/bitcoin/pull/10117#issuecomment-290275236
2017-03-27Make qt wallet test compatible with qt4Russell Yanofsky
Unlike Qt5, the Qt4 signals implementation doesn't allow a signal to be directly connected to a c++ lambda expression. Work around this by defining a Callback QObject with a virtual method that can forward calls to a closure. The Qt4 error was reported by Patrick Strateman <patrick.strateman@gmail.com> in https://github.com/bitcoin/bitcoin/pull/10039#issuecomment-289248763
2017-03-20Avoid QTimer::singleShot compile error with Qt 5.3.2Russell Yanofsky
Construct QTimer object directly, instead of relying on QTimer::singleShot overloads accepting lambdas, which weren't introduced until Qt 5.4. Avoids the following compile error in debian jessie: ``` qt/test/wallettests.cpp: In function ‘void {anonymous}::ConfirmSend()’: qt/test/wallettests.cpp:34:6: error: no matching function for call to ‘QTimer::singleShot(int, Qt::TimerType, {anonymous}::ConfirmSend()::<lambda()>)’ }); ^ qt/test/wallettests.cpp:34:6: note: candidates are: In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTimer:1:0, from ./qt/sendcoinsdialog.h:13, from qt/test/wallettests.cpp:7: /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note: static void QTimer::singleShot(int, const QObject*, const char*) static void singleShot(int msec, const QObject *receiver, const char *member); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note: no known conversion for argument 2 from ‘Qt::TimerType’ to ‘const QObject*’ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note: static void QTimer::singleShot(int, Qt::TimerType, const QObject*, const char*) static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note: candidate expects 4 arguments, 3 provided ``` Error reported by Pavel Janík <Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287574436
2017-03-20Avoid scoped_connection compile error with boost 1.55.0Russell Yanofsky
Construct scoped_connection directly instead of relying on copy initialization and move constructor. Avoids the following compile error in debian jessie: ``` In file included from /usr/include/boost/signals2/signal.hpp:21:0, from ./util.h:29, from ./dbwrapper.h:11, from ./txdb.h:10, from ./test/test_bitcoin.h:11, from qt/test/wallettests.cpp:11: /usr/include/boost/signals2/connection.hpp: In function ‘uint256 {anonymous}::SendCoins(CWallet&, SendCoinsDialog&, const CBitcoinAddress&, CAmount)’: /usr/include/boost/signals2/connection.hpp:234:7: error: ‘boost::signals2::scoped_connection::scoped_connection(const boost::signals2::scoped_connection&)’ is private scoped_connection(const scoped_connection &other); ^ qt/test/wallettests.cpp:47:6: error: within this context }); ^ ``` Error reported by Pavel Janík <Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287550034
2017-03-15Add simple qt wallet test sending a transactionRussell Yanofsky