aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
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-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-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-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-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
2018-06-12rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequestJoão Barbosa
2018-06-11scripted-diff: Avoid temporary copies when looping over std::mapBen Woosley
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. -BEGIN VERIFY SCRIPT- sed -i -E 's/for \(([^<]*)std::pair<([^c])(.+) : m/for (\1std::pair<const \2\3 : m/' src/*.cpp src/**/*.cpp sed -i -E 's/for \(([^<]*)std::pair<([^c])(.+) : (.*)map/for (\1std::pair<const \2\3 : \4map/' src/*.cpp src/**/*.cpp -END VERIFY SCRIPT-
2018-06-11Merge #13230: Simplify include analysis by enforcing the developer guide's ↵Wladimir J. van der Laan
include syntax 16e3cd380af570fb2f656e0344bab88829a4bcda Clarify include recommendation (practicalswift) 6d10f43738d58bf623975e3124fd5735aac7d3e1 Enforce the use of bracket syntax includes ("#include <foo.h>") (practicalswift) 906bee8e5f474f8718d02e6f1938f20dcfe3d2cc Use bracket syntax includes ("#include <foo.h>") (practicalswift) Pull request description: When analysing includes in the project it is often assumed that the preferred bracket include syntax (`#include <foo.h>`) mentioned in `developer-docs.md` is used consistently. @sipa:s excellent circular dependencies script [`circular-dependencies.py`](https://github.com/sipa/bitcoin/blob/50c69b78011c1bc55885ebfd216db60ed490ebea/contrib/devtools/circular-dependencies.py) (#13228) is an example of a script making this reasonable assumption. This PR enables automatic Travis checking of the include syntax making sure that the bracket syntax includes (`#include <foo.h>`) is used consistently. Tree-SHA512: a414921aabe8e487ebed42f3f1cbd02fecd1add385065c1f2244cd602c31889e61fea5a801507ec501ef9bd309b05d3c999f915cec1c2b44f085bb0d2835c182
2018-06-11wallet: Erase wtxOrderd wtx pointer on removeprunedfundsMarcoFalke
2018-06-11Merge #12634: [refactor] Make TransactionWithinChainLimit more flexibleWladimir J. van der Laan
f77e1d34fd5f17304ce319b5f962b8005592501a test: Add MempoolAncestryTests (Karl-Johan Alm) a08d76bcfee6f563a268933357931abe32060668 mempool: Calculate descendant maximum thoroughly (Karl-Johan Alm) 6d3568371eb2559d65a3e2334252d36a262319e8 wallet: Switch to using ancestor/descendant limits (Karl-Johan Alm) 6888195b062c8c58dd776fd10b44b25554eb1f15 wallet: Strictly greater than for ancestor caps (Karl-Johan Alm) 322b12ac4e0a8c892e81a760ff7225619248b74f Remove deprecated TransactionWithinChainLimit (Karl-Johan Alm) 47847515473b054929af0c8de3d54b6672500cab Switch to GetTransactionAncestry() in OutputEligibleForSpending (Karl-Johan Alm) 475a385a80198a46a6d99846f99b968f04e9b470 Add GetTransactionAncestry to CTxMemPool for general purpose chain limit checking (Karl-Johan Alm) 46847d69d2c1cc908fd779daac7884e365955dbd mempool: Fix max descendants check (Karl-Johan Alm) b9ef21dd727dde33f5bd3c33226b05d07eb12aac mempool: Add explicit max_descendants (Karl-Johan Alm) Pull request description: Currently, `TransactionWithinChainLimit` is restricted to single-output use, and needs to be called every time for different limits. If it is replaced with a chain limit value calculator, that can be called once and reused, and is generally more flexible (see e.g. #12257). Update: this PR now corrects usage of max ancestors / max descendants, including calculating the correct max descendant value, as advertised for the two limits. ~~This change also makes `nMaxAncestors` signed, as the replacement method will return `-1` for "not in the mempool", which is different from "0", which means "no ancestors/descendants in mempool".~~ ~~This is a subset of #12257.~~ Tree-SHA512: aa59c849360542362b3126c0e29d44d3d58f11898e277d38c034dc4b86a5b4500f77ac61767599ce878c876b5c446fec9c02699797eb2fa41e530ec863a00cf9
2018-06-11Merge #13060: [wallet] [rpc] Remove getlabeladdress RPCWladimir J. van der Laan
67e0e04140b3dfac12d628cee391d40b5fac5cfa [wallet] [docs] Update release notes for removing `getlabeladdress` (John Newbery) 81608178cff793ee205a4f70481c76d34c5448a4 [wallet] [rpc] Remove getlabeladdress RPC (John Newbery) Pull request description: labels are associated with addresses (rather than addresses being associated with labels, as was the case with accounts). The getlabeladdress does not make sense in this model, so remove it. getaccountaddress is still supported for one release as the accounts API is deprecated. Tree-SHA512: 7f45d0456248ebcc4e54dd34e2578a09a8ea8e4fceda75238ccea9d731dc99a3f3c0519b18a9739de17d2e6e59c9c2259ba67c9ae2e3cb2a40ddb14b9193fe29
2018-06-11wallet: Switch to using ancestor/descendant limitsKarl-Johan Alm
Instead of combining the -limitancestorcount and -limitdescendantcount into a nMaxChainLength, this commit uses each one separately in the coin eligibility filters.
2018-06-11wallet: Strictly greater than for ancestor capsKarl-Johan Alm
2018-06-11Switch to GetTransactionAncestry() in OutputEligibleForSpendingKarl-Johan Alm
2018-06-11mempool: Add explicit max_descendantsKarl-Johan Alm
TransactionWithinChainLimits would take a 'limit' and check it against ascendants and descendants. This is changed to take an explicit max ancestors and max descendants value, and to test the corresponding value against its corresponding max.
2018-06-06Use bracket syntax includes ("#include <foo.h>")practicalswift
2018-06-05Merge #13269: refactoring: Drop UpdateTransaction in favor of UpdateInputWladimir J. van der Laan
6aa33feadbe11bfa505a80a691d84db966aca134 Drop UpdateTransaction in favor of UpdateInput (Ben Woosley) Pull request description: Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the call (and, often, the enclosing loop). In most cases, this input is already immediately available and need not be looked up. Tree-SHA512: 8c7914a8b7ae975d8ad0e9d760e3c5da65776a5f79d060b8ffb6b3ff7a32235f71ad705f2185b368d9263742d7796bb562395d22b806d90e8502d8c496011e57
2018-06-01Merge #13058: [wallet] `createwallet` RPC - create new wallet at runtimeJonas Schnelli
f7e153e95 [wallets] [docs] Add release notes for createwallet RPC. (John Newbery) 32167e830 [wallet] [tests] Add tests for `createwallet` RPC. (John Newbery) 942131774 [wallet] [rpc] Add `createwallet` RPC (John Newbery) Pull request description: Adds a `createwallet` RPC to dynamically create a new wallet at runtime. Includes tests and release notes. Tree-SHA512: e0d89e3ae498234e9db5b827c56804cbab64f18a1875e2b5e676172c110278ea1b9e93a8a61b8dd80e2f2a691490bf229e923e4ccb284a1d3e420b8317815866
2018-05-31[wallets] [docs] Add release notes for createwallet RPC.John Newbery
2018-05-31Merge #13309: Directly operate with CMutableTransaction in SignSignatureWladimir J. van der Laan
6b8b63af1461dc11ffd813401e2c36fa44656715 Generic TransactionSignatureCreator works with both CTransaction and CMutableTransaction (Martin Ankerl) Pull request description: Refactored `TransactionSignatureCreator` into a templated `GenericTransactionSignatureCreator` that works with both `CMutableTransaction` and `CTransaction`. The advantage is that now in `SignSignature`, the `MutableTransactionSignatureCreator` can now operate directly with the `CMutableTransaction` without the need to copy the data into a `CTransaction`. Running all unit tests brings a very noticable speedup on my machine: 48.4 sec before this change 36.4 sec with this change -------- 12.0 seconds saved running only `--run_test=transaction_tests/test_big_witness_transaction`: 16.7 sec before this change 5.9 sec with this change -------- 10.8 seconds saved This relates to my first attempt with the const_cast hack #13202, and to the slow unit test issue #10026. Also see #13050 which modifies the tests but not the production code (like this PR) to get a speedup. Tree-SHA512: 2cff0e9699f484f26120a40e431a24c8bc8f9e780fd89cb0ecf20c5be3eab6c43f9c359cde244abd9f3620d06c7c354e3b9dd3da41fa2ca1ac1e09386fea25fb
2018-05-30Merge #13069: docs: Fix typosMarcoFalke
d8c4998f31 Fix typos (practicalswift) Pull request description: Fix typos. Tree-SHA512: 9af52a9799e6892b162e4aa1bcd6585502e10650b8aced59e7346dbb2f08544330081eb79328255fad1d358c095507956e049d354c4383b6965d4d5a7d635425
2018-05-30Merge #13252: Wallet: Refactor ReserveKeyFromKeyPool for safetyWladimir J. van der Laan
4b62bdf5136c174621509bf7866fbd89b61cc66a Wallet: Refactor ReserveKeyFromKeyPool for safety (Ben Woosley) Pull request description: ReserveKeyFromKeyPool's previous behaviour is to set nIndex to -1 if the keypool is empty, OR throw an exception for technical failures. Instead, we now return false if the keypool is empty, true if the operation succeeded. This is to make failure more easily detectable by calling code. Tree-SHA512: 753f057ad13bd4c28d121f426bf0967ed72b827d97fb24582f9326ec60072abc5482e3db69ccada7c5fc66de9957fc59098432dd223fc4116991cab44c6d7aef
2018-05-30Generic TransactionSignatureCreator works with both CTransaction and ↵Martin Ankerl
CMutableTransaction Templated version so that no copying of CMutableTransaction into a CTransaction is necessary. This speeds up the test case transaction_tests/test_big_witness_transaction from 7.9 seconds to 3.1 seconds on my machine.
2018-05-30Stop translating command line optionsWladimir J. van der Laan
Many options are extremely technical, and refer internals, making it difficult to translate usefully. This came up in discussion of e.g. #10949. If a message is not understood by translators (which are typically end-users, not developers) they'll either translate it literally, making it harder to understand instead of easier, with the added drawback of the user no longer being able to google it. Also the translation was only working for bitcoin-qt as with the console programs, there is no translation backend. So it was injecting never-used translation messages for bitcoin-cli, -tx. For these reasons, stop translating options help completely. This should not affect the output **in any way** except for bitcoin-qt when a non-English language is configured in the locale. This implements #10962.
2018-05-29policy: Treat segwit as always activeMarcoFalke
2018-05-29Merge #13142: Separate IsMine from solvabilityWladimir J. van der Laan
c004ffc9b42a738043e19e4c812fc7e0566119c5 Make handling of invalid in IsMine more uniform (Pieter Wuille) a53f0feff8d42b7a40d417f77dc8de682dd88fd9 Add some checks for invalid recursion in IsMine (Pieter Wuille) b5802a9f5f69815d3290361fd8c96d76a037832f Simplify IsMine logic (Pieter Wuille) 4e91820531889e309dc4335fe0de8229c6426040 Make IsMine stop distinguishing solvable/unsolvable (Pieter Wuille) 6d714c3419b368671bd071a8992950c3dc00e613 Make coincontrol use IsSolvable to determine solvability (Pieter Wuille) Pull request description: Our current `IsMine` logic does several things with outputs: * Determine "spendability" (roughly corresponding to "could we sign for this") * Determine "watching" (is this an output directly or indirectly a watched script) * Determine invalidity (is this output definitely not legally spendable, detecting accidental uncompressed pubkeys in witnesses) * Determine "solvability" (would we be able to sign for this ignoring the fact that we may be missing some private keys). The last item (solvability) is mostly unrelated and only rarely needed (there is just one instance, inside the wallet's coin control logic). This PR changes that instance to use the separate `IsSolvable` function, and stop `IsMine` from distinguishing between solvable and unsolvable. As an extra, this also simplifies the `IsMine` logic and adds some extra checks (which wouldn't be hit unless someone adds already invalid scripts to their wallet). Tree-SHA512: 95a6ef75fbf2eedc5ed938c48a8e5d77dcf09c933372acdd0333129fb7301994a78498f9aacce2c8db74275e19260549dd67a83738e187d40b5090cc04f33adf
2018-05-25[wallet] [rpc] Add `createwallet` RPCJohn Newbery
Add a `createwallet` RPC to allow wallets to be created dynamically at runtime. This functionality is currently only available through RPC and newly created wallets will not be displayed in the GUI.
2018-05-25wallet: Unlock spent outputsJoão Barbosa
2018-05-24Merge #13063: Use shared pointer to retain wallet instanceWladimir J. van der Laan
80b4910f7d87983f50047074c3c2397b0a5c4e92 wallet: Use shared pointer to retain wallet instance (João Barbosa) Pull request description: Currently there are 3 places where it makes sense to retain a wallet shared pointer: - `vpwallets`; - `interfaces::Wallet` interface instance - used by the UI; - wallet RPC functions - given by `GetWalletForJSONRPCRequest`. The way it is now it is possible to have, for instance, listunspent RPC and in parallel unload the wallet (once #13111 is merged) without blocking. Once the RPC finishes, the shared pointer will release the wallet. It is also possible to get all existing wallets without blocking because the caller keeps a local list of shared pointers. This is mostly relevant for wallet unloading. This PR replaces #11402. Tree-SHA512: b7e37c7e1ab56626085afe2d40b1628e8d4f0dbda08df01b7e618ecd2d894ce9b83d4219443f444ba889096286eff002f163cb0a48f37063b62e9ba4ccfa6cce
2018-05-23Merge #13011: Cache witness hash in CTransactionWladimir J. van der Laan
fac1223a568fa1ad6dd602350598eed278d115e8 Cache witness hash in CTransaction (MarcoFalke) faab55fbb17f2ea5080bf02bc59eeef5ca746f07 Make CMutableTransaction constructor explicit (MarcoFalke) Pull request description: This speeds up: * compactblocks (v2) * ATMP * validation and miner (via `BlockWitnessMerkleRoot`) * sigcache (see also unrelated #13204) * rpc and rest (nice, but irrelevant) This presumably slows down rescan, which uses a `CTransaction` and its `GetHash`, but never uses the `GetWitnessHash`. The slow down is proportional to the number of witness transactions in the rescan window. I.e. early in the chain there should be no measurable slow down. Later in the chain, there should be a slow down, but acceptable given the speedups in the modules mentioned above. Tree-SHA512: 443e86acfcceb5af2163e68840c581d44159af3fd1fce266cab3504b29fcd74c50812b69a00d41582e7e1c5ea292f420ce5e892cdfab691da9c24ed1c44536c7
2018-05-22wallet: Use shared pointer to retain wallet instanceJoão Barbosa
2018-05-21[wallet] Fix incorrect comment for DeriveNewSeed.John Newbery
2018-05-19[rpc] [wallet] Add 'hdmasterkeyid' alias return values.John Newbery
Restores the return value in getwalletinfo() and getaddressinfo() RPC methods for backwards compatibility
2018-05-19[refactor] manually change remaining instances of master key to seed.John Newbery
2018-05-19scripted-diff: Rename master key to seedJohn Newbery
-BEGIN VERIFY SCRIPT- ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' test | xargs sed -i "s:\<$1\>:$2:g"; } ren GenerateNewHDMasterKey GenerateNewSeed ren DeriveNewMasterHDKey DeriveNewSeed ren SetHDMasterKey SetHDSeed ren hdMasterKeyID hd_seed_id ren masterKeyID seed_id ren SetMaster SetSeed ren hdmasterkeyid hdseedid ren hdmaster hdseed -END VERIFY SCRIPT-
2018-05-18Drop UpdateTransaction in favor of UpdateInputBen Woosley
Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the method. In most cases, this input is already immediately available and need not be looked up.
2018-05-17wallet: Exit SyncMetaData if there are no transactions to syncWladimir J. van der Laan
Instead of crash with an assertion error, simply exit the function `SyncMetaData` if there is no metadata to sync. Fixes #13110.
2018-05-16Wallet: Refactor ReserveKeyFromKeyPool for safetyBen Woosley
ReserveKeyFromKeyPool's previous behaviour is to set nIndex to -1 if the keypool is empty, OR throw an exception for technical failures. Instead, we now return false if the keypool is empty, true if the operation succeeded. This is to make failure more easily detectable by calling code.
2018-05-16[wallet] [rpc] Remove getlabeladdress RPCJohn Newbery
labels are associated with addresses (rather than addresses being associated with labels, as was the case with accounts). The getlabeladdress does not make sense in this model, so remove it. getaccountaddress is still supported for one release as the accounts API is deprecated.