aboutsummaryrefslogtreecommitdiff
path: root/src/qt/test/wallettests.cpp
AgeCommit message (Collapse)Author
2020-09-01wallet: Reload previously loaded wallets on GUI startupAndrew Chow
Enable the GUI to also use the load_on_startup feature. Wallets loaded in the GUI always have load_on_startup=true. When they are unloaded from the GUI, load_on_startup=false. To facilitate this change, UpdateWalletSetting is moved into the wallet module and called from within LoadWallet, RemoveWallet, and Createwallet. This change does not actually touch the GUI code but rather the wallet functions that are shared between the GUI and RPC.
2020-08-26gui: Replace interface::Node references with pointersRussell Yanofsky
No change in behavior. Replacing references with pointers allows Node interface creation to be delayed until later during gui startup next commit to support implementing -ipcconnect option
2020-07-13test: Remove duplicate NodeContext hacksRussell Yanofsky
Qt tests currently are currently using two NodeContext structs at the same time, one in interfaces::NodeImpl::m_context, and the other in BasicTestingSetup::m_node, and the tests have hacks transferring state between them. Fix this by getting rid of the NodeImpl::m_context struct and making it a pointer. This way a common BitcoinApplication object can be used for all qt tests, but they can still have their own testing setups. Non-test code is changing but non-test behavior is still the same as before. Motivation for this PR is to be able to remove the "std::move(test.m_node.connman)" and mempool hacks for swapping individual NodeContext members in Qt tests, because followup PR #19099 adds yet another member (wallet_client) that needs to be swapped. After this change, the whole NodeContext struct can be swapped instead of individual members, so the workarounds are less fragile and invasive.
2020-06-18Merge #19310: wallet: BerkeleyDatabase make BerkeleyDatabase::Create, ↵MarcoFalke
CreateMock, and CreateDummy non-static functions da7a83c5ee6a51ff4c3eb35dbd447a310c4a0387 Remove WalletDatabase::Create, CreateMock, and CreateDummy (Andrew Chow) d6045d0ac615b5984b72e83cb25aa8a245a177a0 scripted-diff: Replace WalletDatabase::Create* with CreateWalletDatabase (Andrew Chow) 45c08f8a7b89dda6afb7d7cf9573a8ae8290ac92 Add Create*WalletDatabase functions (Andrew Chow) Pull request description: Instead of having `Create`, `CreateMock`, and `CreateDummy` being static functions in `BerkeleyDatabase`, move these to standalone functions in `walletdb.cpp`. This prepares us for having different `WalletDatabase` classes. Part of #18971. This was originally one commit but has been split into 3 to make it (hopefully) easier to review. ACKs for top commit: MarcoFalke: ACK da7a83c5ee6a51ff4c3eb35dbd447a310c4a0387 🎂 ryanofsky: Code review ACK da7a83c5ee6a51ff4c3eb35dbd447a310c4a0387. Easy review, nice scripted-diff Tree-SHA512: 1feb7cb3889168c555154bf3701a49095fd6b8cab911d44b7f7efbf6fcee2280ccb3d4afec8a83755b39a592ecd13b90a318faa655c321f87bdabdf1e2312327
2020-06-18scripted-diff: Make SeparatorStyle a scoped enumHennadii Stepanov
-BEGIN VERIFY SCRIPT- # General rename helper: $1 -> $2 rename_global() { sed -i "s/\<$1\>/$2/g" $(git grep -l "$1"); } # Helper to rename SeparatorStyle enumerators rename_value() { sed -i "s/ $1/ $2/g" src/qt/bitcoinunits.h; rename_global $1 "SeparatorStyle::$2"; } rename_global 'enum SeparatorStyle' 'enum class SeparatorStyle' rename_value 'separatorNever' 'NEVER' rename_value 'separatorStandard' 'STANDARD' rename_value 'separatorAlways' 'ALWAYS' -END VERIFY SCRIPT-
2020-06-17scripted-diff: Replace WalletDatabase::Create* with CreateWalletDatabaseAndrew Chow
-BEGIN VERIFY SCRIPT- sed -i -e 's/WalletDatabase::Create(/CreateWalletDatabase(/g' `git grep -l "WalletDatabase::Create("` sed -i -e 's/WalletDatabase::CreateDummy(/CreateDummyWalletDatabase(/g' `git grep -l "WalletDatabase::CreateDummy("` sed -i -e 's/WalletDatabase::CreateMock(/CreateMockWalletDatabase(/g' `git grep -l "WalletDatabase::CreateMock("` -END VERIFY SCRIPT-
2020-05-29Merge #17597: qt: Fix height of QR-less ReceiveRequestDialogJonas Schnelli
73529f0859c060087dd41e9e176fd4198d0f385f qt: Rename slot to updateDisplayUnit() (Hennadii Stepanov) 68288ef0c15522799d4bf6239d2ae1e8086b5abf qt: Overhaul ReceiveRequestDialog (Hennadii Stepanov) Pull request description: If master (89a1f7a250ef70ff2d65701564f1e24bb9280d90) is compiled without QR support, the "Request payment to..." dialog looks ugly: ![Screenshot from 2019-11-25 19-58-59](https://user-images.githubusercontent.com/32963518/69566647-3d9c1c80-0fc0-11ea-8ff6-183cea9372c5.png) With this PR: ![Screenshot from 2019-12-26 00-42-46](https://user-images.githubusercontent.com/32963518/71451226-221c6100-277a-11ea-94ae-c19a5c6256f7.png) ![Screenshot from 2019-12-26 00-44-34](https://user-images.githubusercontent.com/32963518/71451228-29436f00-277a-11ea-8ac5-1bafe6d73b5c.png) ![Screenshot from 2019-12-26 00-48-51](https://user-images.githubusercontent.com/32963518/71451230-2e082300-277a-11ea-8c4c-726ca7b776e7.png) Other minor changes: - "URI" abbreviation is not translated now - wallet name is shown if available ACKs for top commit: jonasschnelli: Tested ACK 73529f0859c060087dd41e9e176fd4198d0f385f Tree-SHA512: 45f9a41d3c72978d78eb2e8ca98e274b8be5abf5352fd3e1f4f49514ce744994545fb3012e80600ded936ae41c6be4d4825a0c5f7bcb3db671d69e0299f0f65b
2020-05-29Merge #16432: qt: Add privacy to the Overview pageJonas Schnelli
8d75115844baefe5cad4d82ec8dce001dd16eb9c qt: Add privacy feature to Overview page (Hennadii Stepanov) 73d8ef72742ab9193e9e95158b26176bfaab3f66 qt: Add BitcoinUnits::formatWithPrivacy() function (Hennadii Stepanov) Pull request description: This PR allows to hide/reveal values on the Overviewpage by checking/unchecking Menu->Settings-> Mask Values Closes #16407 Privacy mode is OFF (the default behavior): ![Screenshot from 2020-01-02 15-08-28](https://user-images.githubusercontent.com/32963518/71669074-28ab6980-2d74-11ea-8e54-4973aa307192.png) Privacy mode is ON: ![Screenshot from 2020-01-02 15-10-23 cropped](https://user-images.githubusercontent.com/32963518/71669082-2d701d80-2d74-11ea-9df5-d4acc4982dbe.png) ACKs for top commit: jonatack: Tested ACK 8d75115 jonasschnelli: Tested ACK 8d75115844baefe5cad4d82ec8dce001dd16eb9c Tree-SHA512: 42f396d5bf0d343b306fb7e925f86f66b3fc3a257af370a812f4be181b5269298f9b23bd8a3ce25ab61de92908c4018d8c2dc8591d11bc58d79c4eb7206fc6ec
2020-05-27qt: Add privacy feature to Overview pageHennadii Stepanov
2020-05-05qt: Overhaul ReceiveRequestDialogHennadii Stepanov
2020-04-30[wallet] Remove locked_chain from CWallet, its RPCs and testsAntoine Riard
This change is intended to make the bitcoin node and its rpc, network and gui interfaces more responsive while the wallet is in use. Currently because the node's cs_main mutex is always locked before the wallet's cs_wallet mutex (to prevent deadlocks), cs_main currently stays locked while the wallet does relatively slow things like creating and listing transactions. This commit only remmove chain lock tacking in wallet code, and invert lock order from cs_main, cs_wallet to cs_wallet, cs_main. must happen at once to avoid any deadlock. Previous commit were only removing Chain::Lock methods to Chain interface and enforcing they take cs_main. Remove LockChain method from CWallet and Chain::Lock interface.
2020-04-19wallet: Refactor WalletRescanReserver to use wallet referenceJoão Barbosa
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-04-14Merge #17954: wallet: Remove calls to Chain::Lock methodsMarcoFalke
48973402d8bccb673eaeb68b7aa86faa39d3cb8a wallet: Avoid use of Chain::Lock in CWallet::GetKeyBirthTimes (Russell Yanofsky) e958ff9ab5607da2cd321f29fc785a6d359e44f4 wallet: Avoid use of Chain::Lock in CWallet::CreateTransaction (Russell Yanofsky) c0d07dc4cba7634cde4e8bf586557772f3248a42 wallet: Avoid use of Chain::Lock in CWallet::ScanForWalletTransactions (Russell Yanofsky) 1be8ff280c78c30baabae9429c53c0bebb89c44d wallet: Avoid use of Chain::Lock in rescanblockchain (Russell Yanofsky) 3cb85ac594f115db99f96b0a0f4bfdcd69ef0590 wallet refactor: Avoid use of Chain::Lock in CWallet::RescanFromTime (Russell Yanofsky) f7ba881bc669451a60fedac58a449794702a3e23 wallet: Avoid use of Chain::Lock in listsinceblock (Russell Yanofsky) bc96a9bfc61afdb696fb92cb644ed5fc3d1793f1 wallet: Avoid use of Chain::Lock in importmulti (Russell Yanofsky) 25a9fcf9e53bfa94e8f8b19a4abfda0f444f6b2a wallet: Avoid use of Chain::Lock in importwallet and dumpwallet (Russell Yanofsky) c1694ce6bb7e19a8722d5583cd85ad17da40bb67 wallet: Avoid use of Chain::Lock in importprunedfunds (Russell Yanofsky) ade5f87971211bc67753f14a0d49e020142efc7c wallet refactor: Avoid use of Chain::Lock in qt wallettests (Russell Yanofsky) f6da44ccce4cfff53433e665305a6fe0a01364e4 wallet: Avoid use of Chain::Lock in tryGetTxStatus and tryGetBalances (Russell Yanofsky) bf30cd4922ea62577d7bf63f5029e8be62665d45 refactor: Add interfaces::FoundBlock class to selectively return block data (Russell Yanofsky) Pull request description: This is a set of changes updating wallet code to make fewer calls to `Chain::Lock` methods, so the `Chain::Lock` class will be easier to remove in #16426 with fewer code changes and small changes to behavior. ACKs for top commit: MarcoFalke: re-ACK 48973402d8, only change is fixing bug 📀 fjahr: re-ACK 48973402d8bccb673eaeb68b7aa86faa39d3cb8a, reviewed rebase and changes since last review, built and ran tests locally ariard: Coce Review ACK 4897340, only changes are one suggested by last review on more accurate variable naming, human-readable output, args comments in `findCommonAncestor` Tree-SHA512: cfd2f559f976b6faaa032794c40c9659191d5597b013abcb6c7968d36b2abb2b14d4e596f8ed8b9a077e96522365261299a241a939b3111eaf729ba0c3ef519b
2020-04-10Merge #17905: gui: Avoid redundant tx status updatesMarcoFalke
96cb597325f64cadb3cf43e2cdb3d7c1e2e49891 gui: Avoid redundant tx status updates (Russell Yanofsky) Pull request description: This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). In `TransactionTablePriv::index`, avoid calling `interfaces::Wallet::tryGetTxStatus` if the status is up to date as of the most recent `NotifyBlockTip` notification. Store height from the most recent notification in a new `ClientModel::cachedNumBlocks` variable in order to check this. This avoids floods of IPC traffic from `tryGetTxStatus` with #10102 when there are a lot of transactions. It might also make the GUI a little more efficient even when there is no IPC. ACKs for top commit: promag: Code review ACK 96cb597325f64cadb3cf43e2cdb3d7c1e2e49891. hebasto: ACK 96cb597325f64cadb3cf43e2cdb3d7c1e2e49891 Tree-SHA512: fce597bf52a813ad4923110d0a39229ea09e1631e0d580ea18cffb09e58cdbb4b111a40a9a9270ff16d8163cd47b0bd9f1fe7e3a6c7ebb19198f049f8dd1aa46
2020-03-31wallet: Avoid use of Chain::Lock in CWallet::ScanForWalletTransactionsRussell Yanofsky
This is a step toward removing the Chain::Lock class and reducing cs_main locking. This change affects behavior in a few small ways. - If there's no max_height specified, percentage progress is measured ending at wallet last processed block instead of node tip - More consistent error reporting: Early check to see if start_block is on the active chain is removed, so start_block is always read and the triggers an error if it's unavailable
2020-03-31wallet refactor: Avoid use of Chain::Lock in qt wallettestsRussell Yanofsky
This is a step toward removing the Chain::Lock class and reducing cs_main locking. This change doesn't affect behavior.
2020-01-23Refactor: Allow LegacyScriptPubKeyMan to be nullAndrew Chow
In CWallet::LoadWallet, use this to detect and empty wallet with no keys This commit does not change behavior.
2020-01-23Locking: Lock cs_KeyStore instead of cs_wallet in legacy keymanAndrew Chow
This commit only affects locking behavior and doesn't have other changes.
2020-01-16Merge #17691: doc: Add missed copyright headersMarcoFalke
fac86ac7b3ceac2f884412c7a9f4bd5bab5e3916 scripted-diff: Add missed copyright headers (Hennadii Stepanov) 6fde9d5e47fc9a1042b3fb68031eab5bf55e508d script: Update EXLUDE list in copyright_header.py (Hennadii Stepanov) 1998152f15fd2b0e83f5068c375a34feaf73db8c script: Add empty line after C++ copyright (Hennadii Stepanov) 071f2fc204f542c5a287ca8835115a2ee0bf2f50 script: Add ability to insert copyright to *.sh (Hennadii Stepanov) Pull request description: This PR improves `contrib/devtools/copyright_header.py` script and adds copyright headers to the files in `src` and `test` directories with two exceptions: - [`src/reverse_iterator.h`](https://github.com/bitcoin/bitcoin/blob/master/src/reverse_iterator.h) (added to exceptions) - [`src/test/fuzz/FuzzedDataProvider.h`](https://github.com/bitcoin/bitcoin/blob/master/src/test/fuzz/FuzzedDataProvider.h) (added to exceptions) On master 5622d8f3156a293e61d0964c33d4b21d8c9fd5e0: ``` $ ./contrib/devtools/copyright_header.py report . | grep zero 25 with zero copyrights ``` With this PR: ``` $ ./contrib/devtools/copyright_header.py report . | grep zero 2 with zero copyrights ``` ~I am uncertain about our copyright policy with `build_msvc` and `contrib` directories content, so they are out of scope of this PR.~ ACKs for top commit: MarcoFalke: ACK fac86ac7b3ceac2f884412c7a9f4bd5bab5e3916 Tree-SHA512: d7832c4a7a1a3b7806119775b40ec35d7982f49ff0e6199b8cee4c0e0a36e68d51728b6ee9924b1c161df4bc6105bd93391b79d42914357fa522f499cb113fa8
2020-01-09gui: Avoid redundant tx status updatesRussell Yanofsky
In TransactionTablePriv::index, avoid calling interfaces::Wallet::tryGetTxStatus if the status is up to date as of the most recent NotifyBlockTip notification. Store height from the most recent notification in a new ClientModel::cachedNumBlocks variable in order to check this. This avoids floods of IPC traffic from tryGetTxStatus with #10102 when there are a lot of transactions. It might also make the GUI a little more efficient even when there is no IPC.
2020-01-04scripted-diff: Add missed copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- s() { contrib/devtools/copyright_header.py insert "$1"; } s build_msvc/bitcoin_config.h s build_msvc/msvc-autogen.py s build_msvc/testconsensus/testconsensus.cpp s contrib/devtools/circular-dependencies.py s contrib/devtools/gen-manpages.sh s contrib/filter-lcov.py s contrib/gitian-build.py s contrib/install_db4.sh s src/crypto/sha256_avx2.cpp s src/crypto/sha256_sse41.cpp s src/fs.cpp s src/qt/test/addressbooktests.cpp s src/qt/test/addressbooktests.h s src/qt/test/util.cpp s src/qt/test/util.h s src/qt/test/wallettests.cpp s src/qt/test/wallettests.h s src/test/blockchain_tests.cpp s test/functional/combine_logs.py s test/lint/lint-locale-dependence.sh sed -i '1G' test/lint/lint-shebang.sh s test/lint/lint-shebang.sh -END VERIFY SCRIPT-
2019-12-16Merge #17564: rpc: Use mempool from node context instead of globalMarcoFalke
fa8e650b525e9493bdfa393c0c3e34cb22c78c08 rest: Use mempool from node context instead of global (MarcoFalke) fa660d65d7cc401ad5bbfdc076a074de19a79329 node: Use mempool from node context instead of global (MarcoFalke) facbaf092f1ab298943206603cff6e6e3d30d452 rpc: Use mempool from node context instead of global (MarcoFalke) Pull request description: Currently they are identical, but in the future we might want to turn the mempool into a unique_ptr. Replacing the global with the mempool pointer from the node context simplifies this step. ACKs for top commit: jnewbery: Code review ACK fa8e650b5 ryanofsky: Code review ACK fa8e650b525e9493bdfa393c0c3e34cb22c78c08, Only the discussed REST server changes since the last review. Tree-SHA512: 0836f3f39cf90306455962918446e5f8612e88c32072b92afc30929aea1f17430bbda0e2b3668d36c9d6b97d63a93cf4903185194571108642b7bf5a39b89125
2019-12-05node: Use mempool from node context instead of globalMarcoFalke
2019-11-26[test] qt: add send screen balance testSjors Provoost
2019-11-08Merge #15931: Remove GetDepthInMainChain dependency on locked chain interfaceSamuel Dobson
36b68de5b2938722911db900ca299f7008780d01 Remove getBlockDepth method from Chain::interface (Antoine Riard) b66c429c56c85fa16c309be0b2bca9c25fdd3e1a Remove locked_chain from GetDepthInMainChain and its callers (Antoine Riard) 0ff03871add000f8b4d8f82aeb168eed2fc9dc5f Use CWallet::m_last_block_processed_height in GetDepthInMainChain (Antoine Riard) f77b1de16feee097a88e99d2ecdd4d84beb4f915 Only return early from BlockUntilSyncedToCurrentChain if current tip is exact match (Antoine Riard) 769ff05e48fb53d4b62c59060424a0fea71d0aab Refactor some importprunedfunds checks with guard clause (Antoine Riard) 5971d3848e09abf571e5308185275296127efca4 Add block_height field in struct Confirmation (Antoine Riard) 9700fcb47feca9d78e005b8d18b41148c8f6b25f Replace CWalletTx::SetConf by Confirmation initialization list (Antoine Riard) 5aacc3eff15b9b5bdc951f1e274f00d581f63bce Add m_last_block_processed_height field in CWallet (Antoine Riard) 10b4729e33f76092bd8cfa06d1a5e0a066436f76 Pass block height in Chain::BlockConnected/Chain::BlockDisconnected (Antoine Riard) Pull request description: Work starter to remove Chain::Lock interface by adding m_last_block_processed_height in CWallet and m_block_height in CMerkleTx to avoid GetDepthInMainChain having to keep a lock . Once this one done, it should ease work to wipe out more cs_main locks from wallet code. I think it's ready for a first round of review before to get further. - `BlockUntilSyncedToCurrent` : restrain isPotentialTip to isTip because we want to be sure that wallet see BlockDisconnected callbacks if its height differs from the Chain one. It means during a reorg, an RPC could return before the BlockDisconnected callback had been triggered. This could cause a tx that had been included in the disconnected block to be displayed as confirmed, for example. ~~- `AbandonTransaction` : in case of conflicted tx (nIndex = -1), we set its m_block_height to the one of conflicting blocks, but if this height is superior to CWallet::m_last_block_processed_height, that means tx isn't conflicted anymore so we return 0 as tx is again unconfirmed~~ After #16624, we instead rely on Confirmation. ~~- `AddToWalletIfInvolvingMe`: in case of block disconnected, transactions are added to mempool again, so we need to replace old txn in `mapWallet` with a height set to zero so we remove check on block_hash.IsNull~~ Already done in #16624 ACKs for top commit: jnewbery: @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch (36b68de5b2938722911db900ca299f7008780d01). jkczyz: > @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch ([36b68de](https://github.com/bitcoin/bitcoin/commit/36b68de5b2938722911db900ca299f7008780d01)). meshcollider: utACK 36b68de5b2938722911db900ca299f7008780d01 ryanofsky: Code review ACK 36b68de5b2938722911db900ca299f7008780d01. Changes since last review: new jkczyz refactor importprunedfunds commit, changed BlockUntilSyncedToCurrentChainChanges commit title and description, changed Confirmation struct field order and line-wrapped comment jnewbery: utACK 36b68de5b2938722911db900ca299f7008780d01 promag: Code review ACK 36b68de5b2938722911db900ca299f7008780d01. Tree-SHA512: 08b89a0bcc39f67c82a6cb6aee195e6a11697770c788ba737b90986b4893f44e90d1ab9ef87239ea3766508b7e24ea882b7199df41173ab27a3d000328c14644
2019-11-06scripted-diff: test: Move setup_common to test libraryMarcoFalke
-BEGIN VERIFY SCRIPT- # Move files for f in $(git ls-files src/test/lib/); do git mv $f src/test/util/; done git mv src/test/setup_common.cpp src/test/util/ git mv src/test/setup_common.h src/test/util/ # Replace Windows paths sed -i -e 's|\\setup_common|\\util\\setup_common|g' $(git grep -l '\\setup_common') sed -i -e 's|src\\test\\lib\\|src\\test\\util\\|g' build_msvc/test_bitcoin/test_bitcoin.vcxproj # Everything else sed -i -e 's|/setup_common|/util/setup_common|g' $(git grep -l 'setup_common') sed -i -e 's|test/lib/|test/util/|g' $(git grep -l 'test/lib/') # Fix include guard sed -i -e 's|BITCOIN_TEST_SETUP_COMMON_H|BITCOIN_TEST_UTIL_SETUP_COMMON_H|g' ./src/test/util/setup_common.h sed -i -e 's|BITCOIN_TEST_LIB_|BITCOIN_TEST_UTIL_|g' $(git grep -l 'BITCOIN_TEST_LIB_') -END VERIFY SCRIPT-
2019-11-05Add m_last_block_processed_height field in CWalletAntoine Riard
At BlockConnected/BlockDisconnected, we rely on height of block itself to know current height of wallet
2019-10-30Merge #16839: Replace Connman and BanMan globals with NodeContext localWladimir J. van der Laan
362ded410b8cb1104b7ef31ff8488fec4824a7d5 Avoid using g_rpc_node global in wallet code (Russell Yanofsky) 8922d7f6b751a3e6b3b9f6fb7961c442877fb65a scripted-diff: Remove g_connman, g_banman globals (Russell Yanofsky) e6f4f895d5e42feaf7bfa5f41e80292aaa73cd7d Pass NodeContext, ConnMan, BanMan references more places (Russell Yanofsky) 4d5448c76b71c9d91399c31b043237091be2e5e7 MOVEONLY: Move NodeContext struct to node/context.h (Russell Yanofsky) 301bd41a2e6765b185bd55f4c541f9e27aeea29d scripted-diff: Rename InitInterfaces to NodeContext (Russell Yanofsky) Pull request description: This change is mainly a naming / organization change intended to simplify #10102. It: - Renames struct InitInterfaces to struct NodeContext and moves it from src/init.h to src/node/context.h. This is a cosmetic change intended to make the point of the struct more obvious. - Gets rid of BanMan and ConnMan globals making them NodeContext members instead. Getting rid of these globals has been talked about in past as a way to implement testing and simulations. Making them NodeContext members is a way of keeping them accessible without the globals. - Splits g_rpc_interfaces global into g_rpc_node and g_rpc_chain globals. This better separates node and wallet rpc methods. Node RPC methods should have access NodeContext, while wallet RPC methods should only have indirect access to node functionality via interfaces::Chain. - Adds NodeContext& references to interfaces::Chain class and the interfaces::MakeChain() function. This is needed to access ConnMan and BanMan instances without the globals. - Gets rid of redundant Node and Chain instances in Qt tests. This is needed due to the previous MakeChain change, and also makes test setup a little more straightforward. More cleanup could be done in the future, but it will require deduplication of bitcoind, bitcoin-qt, and TestingSetup init code. ACKs for top commit: laanwj: ACK 362ded410b8cb1104b7ef31ff8488fec4824a7d5 Tree-SHA512: 9ae6ff1e33423291d1e52056bac95e0874538390892a6e83c4c115b3c73155a8827c0191b46eb3d14e3b3f6c23ccb08095490880fbc3188026319c71739f7db2
2019-10-28scripted-diff: Remove g_connman, g_banman globalsRussell Yanofsky
-BEGIN VERIFY SCRIPT- sed -i 's:#include <interfaces/chain.h>:#include <banman.h>\n#include <interfaces/chain.h>\n#include <net.h>\n#include <net_processing.h>:' src/node/context.cpp sed -i 's/namespace interfaces {/class BanMan;\nclass CConnman;\nclass PeerLogicValidation;\n&/' src/node/context.h sed -i 's/std::unique_ptr<interfaces::Chain> chain/std::unique_ptr<CConnman> connman;\n std::unique_ptr<PeerLogicValidation> peer_logic;\n std::unique_ptr<BanMan> banman;\n &/' src/node/context.h sed -i '/std::unique_ptr<[^>]\+> \(g_connman\|g_banman\|peerLogic\);/d' src/banman.h src/net.h src/init.cpp sed -i 's/g_connman/m_context.connman/g' src/interfaces/node.cpp sed -i 's/g_banman/m_context.banman/g' src/interfaces/node.cpp sed -i 's/g_connman/m_node.connman/g' src/interfaces/chain.cpp src/test/setup_common.cpp sed -i 's/g_banman/m_node.banman/g' src/test/setup_common.cpp sed -i 's/g_connman/node.connman/g' src/init.cpp src/node/transaction.cpp sed -i 's/g_banman/node.banman/g' src/init.cpp sed -i 's/peerLogic/node.peer_logic/g' src/init.cpp sed -i 's/g_connman/g_rpc_node->connman/g' src/rpc/mining.cpp src/rpc/net.cpp src/rpc/rawtransaction.cpp sed -i 's/g_banman/g_rpc_node->banman/g' src/rpc/net.cpp sed -i 's/std::shared_ptr<CWallet> wallet =/node.context()->connman = std::move(test.m_node.connman);\n &/' src/qt/test/wallettests.cpp -END VERIFY SCRIPT-
2019-10-28Pass NodeContext, ConnMan, BanMan references more placesRussell Yanofsky
So g_connman and g_banman globals can be removed next commit.
2019-10-25Refactor: Split up CWallet and LegacyScriptPubKeyMan and classesAndrew Chow
This moves CWallet members and methods dealing with keys to a new LegacyScriptPubKeyMan class, and updates calling code to reference the new class instead of CWallet. Most of the changes are simple text replacements and variable substitutions easily verified with: git log -p -n1 -U0 --word-diff-regex=. The only nontrivial chunk of code added is the new LegacyScriptPubKeyMan class declaration, but this code isn't new and is just selectively copied and moved from the previous CWallet class declaration. This can be verified with: git log -p -n1 --color-moved=dimmed_zebra src/wallet/scriptpubkeyman.h src/wallet/wallet.h or git diff HEAD~1:src/wallet/wallet.h HEAD:src/wallet/scriptpubkeyman.h This commit does not change behavior.
2019-10-01doc: Explain QT_QPA_PLATFORM for gui testsMarcoFalke
2019-07-08qt: Assert QMetaObject::invokeMethod resultJoão Barbosa
2019-06-02Make reasoning about dependencies easier by not including unused dependenciespracticalswift
2019-05-17scripted-diff: Rename LockAnnotation to LockAssertionpracticalswift
-BEGIN VERIFY SCRIPT- git grep -l LockAnnotation | xargs sed -i 's/LockAnnotation/LockAssertion/' -END VERIFY SCRIPT-
2019-05-13[refactor] interfaces: Add missing LockAnnotation for cs_mainMarcoFalke
2019-05-09Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated ↵Wladimir J. van der Laan
types 78e407ad0c26190a22de1bc8ed900164a44a36c3 GetKeyBirthTimes should return key ids, not destinations (Gregory Sanders) 70946e7fee54323ce6a5ea8aeb377e2c7c790bc6 Replace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders) Pull request description: The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types. New types: `CScriptID`->`ScriptHash` `CKeyID`->`PKHash` ACKs for commit 78e407: ryanofsky: utACK 78e407ad0c26190a22de1bc8ed900164a44a36c3. Only changes are removing extra CScriptID()s and fixing the test case. Sjors: utACK 78e407a meshcollider: utACK https://github.com/bitcoin/bitcoin/pull/15452/commits/78e407ad0c26190a22de1bc8ed900164a44a36c3 Tree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
2019-05-03scripted-diff: replace chainActive -> ::ChainActive()James O'Beirne
Though at the moment ChainActive() simply references `g_chainstate.m_chain`, doing this change now clears the way for multiple chainstate usage and allows us to script the diff. -BEGIN VERIFY SCRIPT- git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g' -END VERIFY SCRIPT-
2019-04-29Replace CScriptID and CKeyID in CTxDestination with dedicated typesGregory Sanders
2019-04-15Merge #15788: test: Unify testing setups for fuzz, bench, and unit testsMarcoFalke
faf400077d scripted-diff: Bump copyright headers in test, bench (MarcoFalke) fa821904bf scripted-diff: Rename test_bitcoin to test/setup_common (MarcoFalke) fa8685d49e test: Use test_bitcoin setup in bench, Add test utils (MarcoFalke) 666696b673 test: Have segwit always active in (Basic)TestingSetup (MarcoFalke) Pull request description: Now that the fuzz tests can use the BasicTestingSetup [1], do the same for bench. Also move some duplicate code to a common "test/util" module. [1]: fuzz: Link BasicTestingSetup (shared with unit tests) #15504 ACKs for commit faf400: jonatack: ACK https://github.com/bitcoin/bitcoin/pull/15788/commits/faf400077d0144363c2dd24187431d958fb149a9 Tree-SHA512: 8ac5692e72cf50e460958f291643ae6b8bb04d5c1331ed50dce9eb4e9457e5a925144c532c42b360a26707e11eeece74aab27db8c76ab9a429b9dd7167e7cdc4
2019-04-11scripted-diff: Rename test_bitcoin to test/setup_commonMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin) git mv ./src/test/test_bitcoin.h ./src/test/setup_common.h git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h -END VERIFY SCRIPT-
2019-04-10bitcoin-wallet tool: Drop MakeChain callsRussell Yanofsky
Pass null Chain interface pointer to CWallet. This is needed to drop libbitcoin_server dependency and avoid linking node code.
2019-02-01Rename ScanResult stop_block fieldRussell Yanofsky
Avoid confusion with stop_block argument as suggested https://github.com/bitcoin/bitcoin/pull/14711#discussion_r252038449
2019-01-15Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new ↵Russell Yanofsky
Chain apis Only change in behavior is "Rescan started from block <height>" message replaced by "Rescan started from block <hash>" message in ScanForWalletTransactions. Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2018-11-13Add stop_block out arg to ScanForWalletTransactionsBen Woosley
Accurately reports the last block successfully scanned, replacing a return of the chain tip, which represented possibly inaccurated data in a race condition.
2018-11-13Return a status enum from ScanForWalletTransactionsBen Woosley
Return the failed block as an out var. This clarifies the outcome as the prior return value could be null due to user abort or failure.
2018-11-06Remove uses of cs_main in wallet codeRussell Yanofsky
This commit does not change behavior. It is easiest to review this change with: git log -p -n1 -U0
2018-11-06Pass chain and client variables where neededRussell Yanofsky
This commit does not change behavior. All it does is pass new function parameters. It is easiest to review this change with: git log -p -n1 -U0 --word-diff-regex=.
2018-10-25wallet: Refactor to use WalletLocationJoão Barbosa