aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2018-12-21Merge #14653: rpcwallet: Add missing transaction categories to rpc helptextsMarcoFalke
f3f6dde56e Test coinbase category in wallet rpcs (andrewtoth) e982f0b682 Add all category options to wallet rpc help (andrewtoth) Pull request description: The current helptext for `listtransactions`, `listsinceblock` and `gettransaction` only list two of the five possible options for `category`. This incorrectly implies that these are the only two options, and can cause problems if the other three options aren't accounted for. Also, some of the documentation is incorrect when specifying which options are returned for which categories. This PR updates the helptext for these RPCs and adds a functional regression test for the cases when the other three categories are returned. Tree-SHA512: 67dd7ff6269a3b0f17f5d1a61b0ae1fb1f3778f05e1c440bfbb9b3a005c9c6d740abcace20f3d597cf2bd6779c494448690f13fab0bd2340f206213bc7890b51
2018-12-17wallet: Initialize stop_block to nullptr in CWallet::ScanForWalletTransactionsBen Woosley
Previously the argument would be untouched if the first block scan failed. This makes the behavior predictable, and consistent with the documentation.
2018-12-14Merge #14821: Replace CAffectedKeysVisitor with descriptor based logicMeshCollider
0e75f44a0 Replace CAffectedKeysVisitor with descriptor based logic (Pieter Wuille) Pull request description: It seems we don't need a custom visitor pattern anymore to find what keys are affected by a script. Instead, infer the descriptor, and see which keys it expands to. Tree-SHA512: 8a52f61fb74e8ebfd8d02e759629e423ced6bd7d9a9ee7c4bdd2cca8465bc27b951cc69c8d835244a611ba55c6d22f83b81acef05487cb988c88c0951b797699
2018-12-12Introduce a Shuffle for FastRandomContext and use it in wallet and coinselectionPieter Wuille
2018-12-12Merge #13076: Fix ScanForWalletTransactions to return an enum indicating ↵MeshCollider
scan result: success / failure / user_abort bd3b0361d Add stop_block out arg to ScanForWalletTransactions (Ben Woosley) 3002d6cf3 Return a status enum from ScanForWalletTransactions (Ben Woosley) bb24d6865 Make CWallet::ScanForWalletTransactions args and return value const (Ben Woosley) Pull request description: Return the failed block as an out arg. Fixes #11450. /cc #12275 Tree-SHA512: 6a523e5425ebfe24e664a942ae21c797ccc1281c25b1bf8d02ad95c19dae343fd8051985ef11853474de7628fd6bed5f15190fbc087c3466ce6fdecab37d72a9
2018-12-10Merge #14877: rpc: Document default values for optional argumentsMarcoFalke
fa0c24c96e rpc: Document default values for optional arguments (MarcoFalke) Pull request description: Tree-SHA512: e1f5ea67d7ac67526ae87bffaeb308a9ad68632e161fe0148cd431a340bb7a30def18f1dbc7e98c6c1c269ac8942fd5d5334c85c48e4fb1cead70a42536b6eef
2018-12-07rpc: Document default values for optional argumentsMarcoFalke
2018-12-06rpc: Avoid creating non-standard raw transactionsMarcoFalke
2018-12-05Merge #14796: rpc: Pass argument descriptions to RPCHelpManMarcoFalke
fabca42c68 RPCHelpMan: Add space after colons in extended description (MarcoFalke) fafd040f73 rpc: Add description to fundrawtransaction vout_index (MarcoFalke) 1db0096f61 rpc: Pass argument descriptions to RPCHelpMan (MarcoFalke) Pull request description: This will normalize the type names and formatting for the rpc arguments Tree-SHA512: 6ab344882f0fed36046ab4636cb2fa5d2479c6aae22666ca9a0d067edbb9eff8de98010ad97c8ce40ab532d15d1ae67120a561b0bf3da837090d7de427679f4f
2018-12-04rpc: Add description to fundrawtransaction vout_indexMarcoFalke
2018-12-04Merge #14760: Log env path in BerkeleyEnvironment::FlushWladimir J. van der Laan
467461030 Log env path in BerkeleyEnvironment::Flush (João Barbosa) Pull request description: With `bitcoind -regtest -wallet=w1 -wallet=w2 -debug`, before: ``` BerkeleyEnvironment::Flush: Flush(true) BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)... BerkeleyEnvironment::Flush: wallet.dat checkpoint BerkeleyEnvironment::Flush: wallet.dat detach BerkeleyEnvironment::Flush: wallet.dat closed BerkeleyEnvironment::Flush: Flush(true) took 23ms BerkeleyEnvironment::Flush: Flush(true) BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)... BerkeleyEnvironment::Flush: wallet.dat checkpoint BerkeleyEnvironment::Flush: wallet.dat detach BerkeleyEnvironment::Flush: wallet.dat closed BerkeleyEnvironment::Flush: Flush(true) took 19ms ``` After: ``` BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w1] Flush(true) BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)... BerkeleyEnvironment::Flush: wallet.dat checkpoint BerkeleyEnvironment::Flush: wallet.dat detach BerkeleyEnvironment::Flush: wallet.dat closed BerkeleyEnvironment::Flush: Flush(true) took 23ms BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w2] Flush(true) BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)... BerkeleyEnvironment::Flush: wallet.dat checkpoint BerkeleyEnvironment::Flush: wallet.dat detach BerkeleyEnvironment::Flush: wallet.dat closed BerkeleyEnvironment::Flush: Flush(true) took 19ms ``` Tree-SHA512: f90b413cca5d2527324a264ce371dc8baba69f5b541f7d7f6238a8dd79398cbd3c67c0d7a8a0b69aec6c44d77ba26a079c2241427e3669ed22c7da0e4d60039e
2018-12-01Add all category options to wallet rpc helpandrewtoth
2018-11-30Merge #14380: fix assert crash when specified change output spend size is ↵MarcoFalke
unknown 0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change (Gregory Sanders) b06483c96a Remove stale comment in CalculateMaximumSignedInputSize (Gregory Sanders) Pull request description: This is triggered anytime a fundraw type call(psbt or legacy) is used with a change output address that the wallet doesn't know how to sign for. This regression was added in 6a34ff5335786615771ca423134a484b04831c4e since BnB coin selection actually cares about this. The fix is to assume the smallest typical spend, a P2SH-P2WPKH, which is calculated using a "prototype" dummy signature flow. Future work could generalize this infrastructure to get estimated sizes of inputs for a variety of types. I also removed a comment which I believe is stale and misleading. Tree-SHA512: c7e2be189e524f81a7aa4454ad9370cefba715e3781f1e462c8bab77e4d27540191419029e3ebda11e3744c0703271e479dcd560d05e4d470048d9633e34da16
2018-11-27Replace CAffectedKeysVisitor with descriptor based logicPieter Wuille
2018-11-27Merge #14477: Add ability to convert solvability info to descriptorPieter Wuille
109699dd33 Add release notes (Pieter Wuille) b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille) 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille) 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille) 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille) 4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille) Pull request description: This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts. The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses. This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys). Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors). Fixes #14503. Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27rpc: Pass argument descriptions to RPCHelpManMarcoFalke
2018-11-26qa: Add wallet_encryption error testsMarcoFalke
2018-11-23Merge #14726: Use RPCHelpMan for all RPCsWladimir J. van der Laan
fa5e0452e875a7ca6bf6fe61fdd652d341eece40 rpc: Documentation fixups (MarcoFalke) fa91e8eda541acdb78ca481b74605639f319c108 Use RPCHelpMan for all RPCs (MarcoFalke) fa520e72f7b5964cea1ade666e71212914556cf3 lint: Must use RPCHelpMan to generate the RPC docs (MarcoFalke) Pull request description: The resulting documentation should not change unless the type in the oneline-summary was previously incorrect. (E.g. string vs bool) Tree-SHA512: 4ff355b6a53178f02781e97a7aca7ee1d0d97ff348b6bf5a01caa1c96904ee33c704465fae54c2cd7445097427fd04c71ad3779bb7a7ed886055ef36c1b5a1d0
2018-11-20Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.Wladimir J. van der Laan
591203149f1700f594f781862e88cbbfe83d8d37 wallet: Create IsDatabaseLoaded function (Chun Kuan Lee) 15c93f075a881deb3ad7b1dd8a4516a9b06e5e11 wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee) c456fbd8dfcc748e5ec9feaa57ec0f2900f99cde Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky) Pull request description: Fix #14538 Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is: https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/db.cpp#L44 But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here: https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/db.cpp#L467 Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths: https://github.com/bitcoin/bitcoin/blob/6b8d0a2164b30eab76e7bccb1ffb056a10fba406/src/wallet/wallet.cpp#L3853 This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once. Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
2018-11-19Log env path in BerkeleyEnvironment::FlushJoão Barbosa
2018-11-14Add descriptors to listunspent and getaddressinfo + testsPieter Wuille
2018-11-14Use RPCHelpMan for all RPCsMarcoFalke
2018-11-14Merge #14411: [wallet] Restore ability to list incoming transactions by labelMarcoFalke
da427dbd48 Rename ListTransactions filter variable (Russell Yanofsky) 65b740f92b [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky) Pull request description: This change partially reverts #13075 and #14023. Fixes #14382 Tree-SHA512: 8c4e56104b3a45784cdc06bae8e5facdfff04fe3545b63a35e0ec2e440a41b79d84833ca4c4e728d8af7ebb8a519303a9eda7bee4bbfb92bd50c58587a33eb30
2018-11-14Merge #14478: Show error to user when corrupt wallet unlock failsMarcoFalke
b4f6e58ca5 Better error message for user when corrupt wallet unlock fails (MeshCollider) Pull request description: Mentioned here: https://github.com/bitcoin/bitcoin/issues/14461#issuecomment-429183503 Current behavior is to assert(false) and crash, only info is printed in the log. This shows the message to the user before abort() instead. Tree-SHA512: 526f9ed9262257fca55caf7153ab913ed958b13b079d2f01db797485614d8c375815a1554276e8cf73d3838104b2691a9cf85c8d097973127ae8de9e111446bf
2018-11-13Rename ListTransactions filter variableRussell Yanofsky
Suggested by MeshCollider <dobsonsa68@gmail.com> in https://github.com/bitcoin/bitcoin/pull/14411#discussion_r232134086
2018-11-13Merge #14720: rpc: Correctly name argumentsMarcoFalke
fa0815c300 rpc: Correctly name arguments (Jon Layton) Pull request description: Consistently use the same name to describe arguments in the documentation and add a test that uses the name. By splitting it up, the changes are easier to potentially backport and also make review easier when we switch to `RPCHelpMan`. The tests should pass with or without the changes in `src`. Partly stolen from #14459 (More RPC help description fixes by ch4ot1c) Tree-SHA512: 1072992b1e93ac41006613523e54a0a8004f529fcb101eb9d74d91474abb0945a5a7539f249905151b904b87448f9efc0cacbd9e052fbe2ea9111e62f3e7249c
2018-11-13[wallet] Restore ability to list incoming transactions by labelRussell Yanofsky
This change partially reverts #13075 and #14023. Fixes #14382
2018-11-13Merge #14679: importmulti: Don't add internal addresses to address bookWladimir J. van der Laan
7afddfa8cefd01249ad59cf2370e7cec90b34f6f importmulti: Don't add internal addresses to address book (Gregory Sanders) Pull request description: Currently anything imported with `internal` will not be treated as change since checking the address book is a primary test of this. Added basic tests of all combinations of arguments and change identification. Resolves https://github.com/bitcoin/bitcoin/issues/14662 Tree-SHA512: a1f08dc624a3fadee93cc5392d50c4796b0c5eedf38e295382f71570f2066d9e978ed6e3962084b902989863fe1273a8642d8fdb094a266d69de10622a4176b0
2018-11-13rpc: Correctly name argumentsJon Layton
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-13Merge #14530: Use RPCHelpMan to generate RPC doc stringsMarcoFalke
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke) fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke) Pull request description: This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs. It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged. Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
2018-11-13Merge #13381: RPC: creates possibility to preserve labels on importprivkeyJonas Schnelli
a6b5ec18f rpc: creates possibility to preserve labels on importprivkey (marcoagner) Pull request description: Closes #13087. As discussed in the issue, this is a feature request instead of a bug report since the behaviour was as intended (i.e. label with default: `''`). With this, the old behaviour is kept while the possibility to achieve the preservation of labels, as expected in the open issue, is added. Tree-SHA512: b33be50e1e7f62f7ddfae953177ba0926e2d848961f9fac7501c2b513322c0cb95787745d07d137488267bad1104ecfdbe800c6747f94162eb07c976835c1386
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-13Make CWallet::ScanForWalletTransactions args and return value constBen Woosley
2018-11-12CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown changeGregory Sanders
2018-11-12Remove stale comment in CalculateMaximumSignedInputSizeGregory Sanders
2018-11-12rpc: Add RPCHelpMan for machine-generated helpMarcoFalke
2018-11-09Merge #14588: Refactor PSBT signing logic to enforce invariant and fix ↵Pieter Wuille
signing bug e13fea975d Add regression test for PSBT signing bug #14473 (Glenn Willen) 565500508a Refactor PSBTInput signing to enforce invariant (Glenn Willen) 0f5bda2bd9 Simplify arguments to SignPSBTInput (Glenn Willen) 53e6fffb8f Add bool PSBTInputSigned (Glenn Willen) 65166d4cf8 New PartiallySignedTransaction constructor from CTransction (Glenn Willen) 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT (Glenn Willen) fe5d22bc67 More concise conversion of CDataStream to string (Glenn Willen) Pull request description: As discussed in the comments on #14473, I think that bug was caused primarily by failure to adhere to the invariant that a PSBTInput always has exactly one of the two utxo fields present -- an invariant that is already enforced by PSBTInput::IsSane, but which we were temporarily suspending during signing. This refactor repairs the invariant, also fixing the bug. It also simplifies some other code, and removes redundant parameters from some related functions. fixes #14473 Tree-SHA512: cbad3428175e30f9b7bac3f600668dd1a8f9acde16b915d27a940a2fa6d5149d4fbe236d5808fd590fb20a032274c99e8cac34bef17f79a53fdf69a5948c0fd0
2018-11-10Better error message for user when corrupt wallet unlock failsMeshCollider
2018-11-09rpc: Include rpc/util.h where needed for RPCHelpManMarcoFalke
Just a preparatory commit to add the header to the includes and run clang-format to sort the include lists. Splitting this up into a separate commit makes future scripted-diffs easier.
2018-11-08wallet: Create IsDatabaseLoaded functionChun Kuan Lee
2018-11-07importmulti: Don't add internal addresses to address bookGregory Sanders
2018-11-06Pass chain locked 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-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-06Remove direct node->wallet calls in init.cppRussell Yanofsky
Route calls during node initialization and shutdown that would happen between a node process and wallet processes through the serializable `Chain::Client` interface, rather than `WalletInitInterface` which is now simpler and only deals with early initialization and parameter interaction. This commit mostly does not change behavior. The only change is that the "Wallet disabled!" and "No wallet support compiled in!" messages are now logged earlier during startup.
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-11-06wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a ↵Chun Kuan Lee
directory.
2018-11-06Refactor: Move m_db pointers into BerkeleyDatabaseRussell Yanofsky
This is a refactoring change that doesn't affect behavior. The motivation behind the change is give BerkeleyEnvironment objects access to BerkeleyDatabase objects so it will be possible to simplify the duplicate wallet check and more reliably avoid opening the same databases twice.
2018-11-05trivial: Don't translate in help textken2812221
2018-11-05Merge #14350: Add WalletLocation classWladimir J. van der Laan
65f3672f3b82a6fa30e5171f85bc8d8a29e0797e wallet: Refactor to use WalletLocation (João Barbosa) 01a4c095c87500650663341533f000c6b613e9da wallet: Add WalletLocation utility class (João Barbosa) Pull request description: Advantages of this change: - avoid resolving wallet absolute path and name repetitively and in multiple places; - avoid calling `GetWalletDir` in multiple places; - extract these details from the actual wallet implementation. The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory. Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686