aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2018-07-13Privatize CWallet::AddToWalletIfInvolvingMeBen Woosley
And document in the header.
2018-07-13Extract CWallet::MarkInputsDirtyBen Woosley
To avoid repeated implementations.
2018-07-13Merge #12944: [wallet] ScanforWalletTransactions should mark input txns as dirtyJonas Schnelli
3c292cc19 ScanforWalletTransactions should mark input txns as dirty (Gregory Sanders) Pull request description: I'm hitting a corner case in my mainnet wallet where I load a restore a wallet, call `rescanblockchain` from RPC, and it's "double counting" an output I've sent to myself since currently it never marks input transactions as dirty. This is fixed by a restart of the wallet. Note that this only happens with keys with birthdate *after* the blocks containing the spent funds which gets scanned on startup, so it's hard to test without a set seed function. Tree-SHA512: ee1fa152bb054b57ab4c734e355df10d241181e0372c81d583be61678fffbabe5ae60b09b05dc1bbbcfb4838df9d8538791d4c1d80a09b84d78ad2f50dcb0a61
2018-07-13wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturityBen Woosley
According to my understanding, it should not be possible for coinbase transactions to be conflicting, thus it should not be possible for GetDepthInMainChain to return a negative result. If it did, this would also result in innacurate results for GetBlocksToMaturity due to the math therein. asserting ensures accuracy.
2018-07-13Fix that CWallet::AbandonTransaction would only traverse one levelBen Woosley
Prior to this change, it would mark only the first layer of child transactions abandoned, due to always following the input hashTx rather than the current now tx.
2018-07-12[QA] add createwallet disableprivatekey testJonas Schnelli
2018-07-12Add disable privatekeys option to createwalletJonas Schnelli
2018-07-12Add option to disable private keys during internal wallet creationJonas Schnelli
2018-07-12Merge #13627: Free keystore.h from file scope level type aliasesWladimir J. van der Laan
d0b9405f964670d6eaa8529f65fa7993b2a406c8 Refactors `keystore.h` type aliases. (251) Pull request description: This pull request frees `keystore.h` from type alias declarations that have been declared at file scope level. `keystore.h` has various type aliases that have been declared ~3 - 6 years ago at file scope level, which can either be encapsulated or removed. Where type alias declarations are encapsulated at the appropriate scope and access level, C++11's `using` notation is used in favor of the `typedef` notation. Tree-SHA512: 1395cdc63e0c7ff5a1b1721675ad4416f71f507e999bd4ba019f03457cbfc08877848f10a8db7f5ccd2cd5ca3f5a291c986616f7703172fb6d79fba7447ffba8
2018-07-12Merge #13145: Use common getPath method to create temp directory in tests.MarcoFalke
075429a482 Use common SetDataDir method to create temp directory in tests. (winder) Pull request description: Took a stab at #12574 Created a `getPath` method which can be used with the `TestingSetup` fixture to create a temp directory. Updated tests using temp directories to use this method. I tried setting up a `BOOST_GLOBAL_FIXTURE` to create a truly global path for all tests but was getting linker errors when including `boost/test/unit_test.hpp` in `test_bitcoin.cpp`. Even if I had gotten the linking to work, it looks like `make check` invokes the test binary a bunch of times, so it may not have worked anyway. Tree-SHA512: b51d0f5fada5d652ccc9362596cf98a742aa47f5daf94f189b5f034d8c035c85d095377befdcff7fb4247154d5160e8c500d70f554a2158e2c185a9d24f694f1
2018-07-12Add facility to store wallet flags (64 bits)Jonas Schnelli
2018-07-11Use common SetDataDir method to create temp directory in tests.winder
2018-07-12Refactors `keystore.h` type aliases.251
This squashed commit either encapsulates type alias declarations at the appropriate scope; or removes type aliases that are not used. The encapsulated type aliases are declared using C++11's `using` notation in favor of the `typedef` notation.
2018-07-11Merge #13114: wallet/keystore: Add Clang thread safety annotations for ↵MarcoFalke
variables guarded by cs_KeyStore 968b76f77c Add missing cs_KeyStore lock (practicalswift) 4bcd5bb87d Add locking annotations for variables guarded by cs_KeyStore (practicalswift) Pull request description: * Add Clang thread safety annotations for variables guarded by `cs_KeyStore` * Add missing `cs_KeyStore` lock Tree-SHA512: 7d93513c2da0cd564b9f1e75aa5156a454a4133eb845020fde8872e685dd5758353e93c33364aeea4a812c08353a810494e503a5ce160cc5be0af5af4bb2e6d7
2018-07-11Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChainBen Woosley
2018-07-09Remove useless mapRequest tracking that just effects Qt display.Matt Corallo
I thought we had removed this a long time ago, TBH, its really confusing feedback to users that we display whether a tx was broadcast to immediate neighbor nodes, given that has little indication of whether the tx propagated very far.
2018-07-10Move AddAndGetDestinationForScript from wallet to outputype moduleAnthony Towns
Makes AddAndGetDestinationForScript use a generic CKeyStore rather than the wallet, and makes it always add the script to the keystore, rather than only adding related (redeem) scripts.
2018-07-09Add outputtype moduleAnthony Towns
Moves OutputType into its own module
2018-07-07Merge #13564: [wallet] loadwallet shouldn't create new wallets.MarcoFalke
ea65182f03 [wallet] loadwallet shouldn't create new wallets. (John Newbery) Pull request description: A bug in the initial implementation of loadwallet meant that if the arguement was a directory that didn't contain a wallet.dat file, a new wallet would be created in that directory. Fix that so that if a directory is passed in, it must contain a wallet.dat file. Bug reported by promag (João Barbosa). Tree-SHA512: 0a59fa8a33fde51a88544ad288b00e4995284fe16424f643076aaba42b8244fff362145217650ee53d518dfab7efbed4237632c34cdd3dcbbecaa9ecaab5fd7b
2018-07-05Merge #13096: [Policy] Fix MAX_STANDARD_TX_WEIGHT checkWladimir J. van der Laan
2f1a30c63 Fix MAX_STANDARD_TX_WEIGHT check (Johnson Lau) Pull request description: As suggested by the constant name and its comment in policy.h, a transaction with a weight of exactly MAX_STANDARD_TX_WEIGHT should be allowed. Users could be confused. Tree-SHA512: af417de1c6a2e6796ebbb39aa0caad8764302ded155cb1bbfbe457e4567c199cc53256189832b17d4aeec369e190b3edd4c6116d5f0b8cf0ede6dfb4ed83bdd3
2018-07-04Merge #13235: Break circular dependency: init -> * -> init by extracting ↵Wladimir J. van der Laan
shutdown.h 1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley) e62fdfeea Drop unused init.h includes (Ben Woosley) Pull request description: Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`. Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2018-07-04Merge #13491: Improve handling of INVALID in IsMineWladimir J. van der Laan
bb582a59c Add P2WSH destination helper and use it instead of manual hashing (Pieter Wuille) eaba1c111 Add additional unit tests for invalid IsMine combinations (Pieter Wuille) e6b9730c4 Do not expose invalidity from IsMine (Pieter Wuille) Pull request description: This improves the handling of INVALID in IsMine: * Extra INVALID conditions were added to `IsMine` (following https://github.com/bitcoin/bitcoin/pull/13142/files#r185349057), but these were untested. Add unit tests for them. * In https://github.com/bitcoin/bitcoin/pull/13142#issuecomment-386396975 it was suggested to merge `isInvalid` into the return status. This PR takes a different approach, and removes the `isInvalid` entirely. It was only ever used inside tests, as normal users of IsMine don't care about the reason for non-mine-ness, only whether it is or not. As the unit tests are extensive enough, it seems sufficient to have a black box text (with tests for both compressed and uncompressed keys). Some addition code simplification is done as well. Tree-SHA512: 3267f8846f3fa4e994f57504b155b0e1bbdf13808c4c04dab7c6886c2c0b88716169cee9c5b350513297e0ca2a00812e3401acf30ac9cde5d892f9fb59ad7fef
2018-07-02Delete double semicolon in wallet.cpp and misc.cppMatteo Sumberaz
2018-06-29[RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts.John Newbery
2018-06-28[wallet] GetBalance can take a min_depth argument.John Newbery
2018-06-28[wallet] factor out GetAvailableWatchOnlyBalance()John Newbery
2018-06-28[wallet] deduplicate GetAvailableCredit logicJohn Newbery
2018-06-28[wallet] Factor out GetWatchOnlyBalance()John Newbery
2018-06-28[wallet] GetBalance can take an isminefilter filter.John Newbery
GetBalance() can now take an ismine filter, which is passed down to GetAvailableCredit. This allows GetBalance to be used to get watch-only balances.
2018-06-28[wallet] loadwallet shouldn't create new wallets.John Newbery
A bug in the initial implementation of loadwallet meant that if the arguement was a directory that didn't contain a wallet.dat file, a new wallet would be created in that directory. Fix that so that if a directory is passed in, it must contain a wallet.dat file. Bug reported by promag (João Barbosa).
2018-06-26Merge #13498: [wallet] Fixups from account API deprecationPieter Wuille
df10f07db1 [wallet] Don't use accounts when checking balance in sendmany (John Newbery) e209184101 [wallet] deprecate sendfrom RPC method. (John Newbery) Pull request description: A couple of fixups from the accounts API deprecation PR (#12953): - properly deprecate `sendfrom` - don't use accounts when calculating balance in `sendmany` (unless the `-deprecatedrpc=accounts` flag is being used) Tree-SHA512: 1befde055067438c4c3391bbff1aaed0e6249efd708c567db3f1faad40a0f28e64f95e5bad0679ae826d24a0239e4bc8a1c392dc93e2e7502343a7f6b1d1845c
2018-06-25Merge #13507: RPC: Fix parameter count check for importpubkeyWladimir J. van der Laan
3f72d04e29caf247a3fee92f86fe0d250d578914 Fix parameter count check for importpubkey. (Kristaps Kaupe) Pull request description: Found this while working on #13464. Parameter count check for `importpubkey` was wrong. Tree-SHA512: aba41b666c6493379f320be5e3e438a6cad1a96429102ff4428c092c48f29c2eead2195792c0b018296f20e1c42eb091dd5b9886c42cecbb1f0d03d5def14705
2018-06-25Break circular dependency: init -> * -> init by extracting shutdown.hBen Woosley
Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `AbortShutdown` for setting it to `false`. Note I originally called `AbortShutdown` `CancelShutdown` but that name was already taken by winuser.h https://travis-ci.org/bitcoin/bitcoin/jobs/386913329 This change also triggered a build error in bench. Fixing it required moving LIBBITCOIN_SERVER after LIBBITCOIN_WALLET in bench_bench_bitcoin_LDADD To make server definitions in src/net.cpp available to wallet methods in src/wallet/wallet.cpp. Specifically, solving: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWalletTx::RelayWalletTransaction(CConnman*)': wallet.cpp:(.text+0x3f0e): undefined reference to `CConnman::NodeFullyConnected(CNode const*)' collect2: error: ld returned 1 exit status https://travis-ci.org/bitcoin/bitcoin/jobs/392133581 Need for remaining init.h includes confirmed via a thorough search with a more specific regex: \bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h
2018-06-24Merge #13160: wallet: Unlock spent outputsWladimir J. van der Laan
fd9b3a71824e33728f267e6f288b6224ad1047e1 test: Output should be unlocked when spent (João Barbosa) 54c3bb4cf805ccee91efb9f8cdadea87e0797989 wallet: Unlock spent outputs (João Barbosa) Pull request description: Fixes #12738. Tree-SHA512: 2c1694727aea0c658d07566c7d11d7afe91218053f84d568fac97413348fa5a977243d6cdeebd1c6550816489e35cb3a31667c8354d9b350de99f979d641d605
2018-06-24Merge #13480: Avoid copies in range-for loops and add a warning to detect themWladimir J. van der Laan
d92204c900d55ebaf2af5c900162b3c2c8c296e2 build: add warning to detect hidden copies in range-for loops (Cory Fields) 466e16e0e8523909f9968c5823691b1d4a3d8175 cleanup: avoid hidden copies in range-for loops (Cory Fields) Pull request description: Following-up on #13241, which was itself a follow-up of #12169. See title. Fixing these would otherwise be a continuous process, adding the warning should keep them from cropping up. Note that the warning seems to be Clang-only for now. Tree-SHA512: ccfb769c3128b3f92c95715abcf21ee2496fe2aa384f80efead1529a28eeb56b98995b531b49a089f8142601389e63f7bb935963d724eacde4f5e1b4a024934b
2018-06-21Merge #13111: Add unloadwallet RPCJonas Schnelli
fe65bdec2 bugfix: Delete walletView in WalletFrame::removeWallet (João Barbosa) 0b82bac76 bugfix: Remove dangling wallet env instance (João Barbosa) 0ee77b207 ui: Support wallets unloaded dynamically (João Barbosa) 9f9b50d5f doc: Add release notes for unloadwallet RPC (João Barbosa) ccbf7ae74 test: Wallet methods are disabled when no wallet is loaded (João Barbosa) 4940a20a4 test: Add functional tests for unloadwallet RPC (João Barbosa) 6608c369b rpc: Add unloadwallet RPC (João Barbosa) 537efe19e rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequest (João Barbosa) Pull request description: This patch adds wallet unload feature via RPC. It also adds UI support for unloaded wallets. Tree-SHA512: 7c7f9f32f7a2266d2df574aa6b95f993c3dc82736f93304562122beb8756fb28cd22d03866b48f493c747441f22d30e196b098dec435cc25e035633f090351ea
2018-06-20Fix parameter count check for importpubkey.Kristaps Kaupe
2018-06-19Qt: load wallet in UI after possible init abortsJonas Schnelli
2018-06-18Decouple wallet version from client versionAndrew Chow
Instead of comparing version numbers in the wallet to the client version number, compare them to the latest supported wallet version in the client. This allows for wallet version numbers to be unrelated to the client version number.
2018-06-18[wallet] Don't use accounts when checking balance in sendmanyJohn Newbery
2018-06-18[wallet] deprecate sendfrom RPC method.John Newbery
2018-06-18bugfix: Remove dangling wallet env instanceJoão Barbosa
2018-06-18test: Wallet methods are disabled when no wallet is loadedJoão Barbosa
2018-06-18rpc: Add unloadwallet RPCJoão Barbosa
2018-06-18Merge #13437: wallet: Erase wtxOrderd wtx pointer on removeprunedfundsWladimir J. van der Laan
faa18ca046e9043b2cf68cb1bd17cc8c60fe26d9 wallet: Erase wtxOrderd wtx pointer on removeprunedfunds (MarcoFalke) Pull request description: This prevents segfaults, when reading from the freed memory. Tree-SHA512: 04f8190dea7901cf1cc298d5db98c83b02858f27114c5ef4da738accd176d6647d6b81f3dc39f3d5912b1a981cf0599370fd391c4154ffbde97afc1fac389123
2018-06-17Add P2WSH destination helper and use it instead of manual hashingPieter Wuille
2018-06-15cleanup: avoid hidden copies in range-for loopsCory Fields
2018-06-15Merge #13241: scripted-diff: Avoid temporary copies when looping over std::mapMarcoFalke
9b72c988a0 scripted-diff: Avoid temporary copies when looping over std::map (Ben Woosley) Pull request description: The ::value_type of the std::map/std::multimap/std::unordered_map containers is std::pair<const Key, T>. Dropping the const results in an unnecessary copy, for example in C++11 range-based loops. For this I started with a more general scripted diff, then narrowed it down based on the inspection showing that all actual map/multimap/unordered_map variables used in loops start with m or have map in the name. Tree-SHA512: b656d66b69ffa1eb954124aa8ae2bc5436ca50262abefa93bdda55cfcdaffc5ff90cd40539051a2bd06355ba69ddf245265cc8764eebff66d761b3aec06155a9
2018-06-14ScanforWalletTransactions should mark input txns as dirtyGregory Sanders
2018-06-12Merge #13120: policy: Treat segwit as always activeWladimir J. van der Laan
fa7a6cf1b36284db70e941bd2915fd6edbb0f9d6 policy: Treat segwit as always active (MarcoFalke) Pull request description: Now that segwit is active for a long time, there is no need to reject transactions with the reason that segwit hasn't activated. Strictly speaking, this is a bug fix, because with the release of 0.16, we create segwit transactions in our wallet by default without checking if they are allowed by local policy. More broadly, this simplifies the code as if "premature witness" was always set to true with the corresponding command line args. Tree-SHA512: 484c26aa3a66faba6b41e8554a91a29bfc15fbf6caae3d5363a3966283143189c4bd5333a610b0669c1238f75620691264e73f6b9f1161cdacf7574d946436da