aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2018-04-12Merge #12803: Make BaseSignatureCreator a pure interfaceWladimir J. van der Laan
be67831 Make DummySignatureCreator a singleton (Pieter Wuille) 190b8d2 Make BaseSignatureCreator a pure interface (Pieter Wuille) Pull request description: * Removes the `m_provider` field from `BaseSignatureCreator`. Instead both a `SigningProvider` (which provides keys and scripts) and a `BaseSignatureCreator` (which implements the transaction-specific (or other) signing logic) are passed into and down in `ProduceSignature`, making the two concepts orthogonal. * Makes `BaseSignatureCreator` a pure interface without constructor, making it easier to implement new derivations of it (for example for message signing). * As `DummySignatureCreator` now becomes a stateless object, turn it into a singleton `DUMMY_SIGNATURE_CREATOR`. Tree-SHA512: 5f1f4512e4ea7d02a31df7b9ede55008efa716c5b74a2630ca1c2fc6599584d8bf5f5641487266127f4b3788033803539fbd22b03ef1219c83c10da2d3da3dcd
2018-04-12Merge #12888: debug log number of unknown wallet records on loadWladimir J. van der Laan
72ec5b7 debug log number of unknown wallet records on load (Gregory Sanders) Pull request description: This would have saved me some time during wallet debugging, with minimal logging clutter. Tree-SHA512: e11a4d73a5b1d2bd73fe7b75b62fdfa127e21b8641c5b0c76f14ecd292ab374c0d4749f6bd99919b2b3e9cb00c3b5e8179386eb39ac656698306b3b545ee79f1
2018-04-11Merge #12837: rpc: fix type mistmatch in `listreceivedbyaddress`MarcoFalke
05c03d1249 rpc: fix type mistmatch in listreceivedbyaddress (joemphilips) Pull request description: `txids` filed in return value is supposed be `string` but it was `numeric` in the help message Tree-SHA512: 7d860994c2d1d9149b41fd7afefc1a44460eede5a023070fcc18b0a4a19a26c5eec5abd157038c15fe7d50a3390bdaf7a4823279129eb1458b0d3c6141a533ee
2018-04-11debug log number of unknown wallet records on loadGregory Sanders
2018-04-11Merge #12925: wallet: Logprint the start of a rescanWladimir J. van der Laan
cab0824 Logprint the start of a rescan (Jonas Schnelli) Pull request description: Right now, there is no log entry when a rescan starts which is confusing especially when a "still rescanning" log entry appears after the log-update timeout of 60s or when user manually aborts the rescan. This PR adds a log entry when a rescan starts. Tree-SHA512: 8712605af6fd60950bf3904cfb586da6022e44b3da6f3155fe4f02aae16df6044bc504b3d48945ea6d7fe768f0c6cb3282a2e2251d14bf3b7f1dcbd12568b05e
2018-04-11Merge #12920: test: Fix sign for expected valuesWladimir J. van der Laan
c55aa4f test: Fix sign for expected values (Karl-Johan Alm) Pull request description: A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs. This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values. Running `make &> make_output_...` on master versus on this PR: ``` $ wc make_output_* 1464 5925 90357 make_output_master 613 1469 28370 make_output_signfixed ``` More than halves the output lines from compiling. Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
2018-04-11Merge #12892: [wallet] [rpc] introduce 'label' API for walletWladimir J. van der Laan
41ba061 [docs] Add release notes for wallet 'label' API. (John Newbery) 189e0ef [wallet] [rpc] introduce 'label' API for wallet (Wladimir J. van der Laan) Pull request description: Add label API to wallet RPC. This is one step towards #3816 ("Remove bolt-on account system") although it doesn't actually remove anything yet. These initially mirror the account functions, with the following differences: - These functions aren't DEPRECATED in the help - Help mentions 'label' instead of accounts. In the language used, labels are associated with addresses, instead of addresses associated with labels. (unlike with accounts.) - Labels have no balance - No balances in `listlabels` - `listlabels` has no minconf or watchonly argument - Like in the GUI, labels can be set on any address, not just receiving addreses - Unlike accounts, labels can be deleted. Being unable to delete them is a common annoyance (see #1231). Currently only by reassigning all addresses using `setlabel`, but an explicit call `deletelabel` which assigns all address to the default label may make sense. Tree-SHA512: 45cc313c68ad529ce3a15c02181d2ab0083a7e14fe824e2cde34972713fecce512e3d4b9aa46db5355f2baa857c44b234d4fe9709225bc23c7ebbc0e03febbf5
2018-04-11test: Fix sign for expected valuesKarl-Johan Alm
A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
2018-04-10[wallet] [rpc] introduce 'label' API for walletWladimir J. van der Laan
Add label API to wallet RPC. This is one step towards #3816 ("Remove bolt-on account system") although it doesn't actually remove anything yet. These initially mirror the account functions, with the following differences: - These functions aren't DEPRECATED in the help - Help mentions 'label' instead of accounts. In the language used, labels are associated with addresses, instead of addresses associated with labels. (unlike with accounts.) - Labels have no balance - No balances in `listlabels` - `listlabels` has no minconf or watchonly argument - Like in the GUI, labels can be set on any address, not just receiving addreses - Unlike accounts, labels can be deleted. Being unable to delete them is a common annoyance (see #1231). Currently only by reassigning all addresses using `setlabel`, but an explicit call `deletelabel` which assigns all address to the default label may make sense. Thanks to Pierre Rochard for test fixes.
2018-04-10Merge #12731: Support serialization as another type without castingWladimir J. van der Laan
818dc74 Support serialization as another type without casting (Pieter Wuille) Pull request description: This adds a `READWRITEAS(type, obj)` macro which serializes `obj` as if it were converted to `const type&` when `const`, and to `type&` when non-`const`. No actual cast is involved, so this only works when this conversion can be done automatically. This makes it usable in serialization code that uses a single implementation for both serialization and deserializing, which doesn't know the constness of the object involved. This is a redo of #12712, using a slightly different interface. Tree-SHA512: 262f0257284ff99b5ffaec9b997c194e221522ba35c3ac8eaa9bb344449d7ea0a314de254dc77449fa7aaa600f8cd9a24da65aade8c1ec6aa80c6e9a7bba5ca7
2018-04-10Merge #12749: [wallet] feebumper: discard change outputs below discard rateWladimir J. van der Laan
f526046 adapt bumpfee change discard test to be more strict and add note on p2sh discrep (Gregory Sanders) 5805d6f feebumper: discard change outputs below discard rate (Gregory Sanders) Pull request description: The "discard rate" is the concept we use to ensure the wallet isnt creating not so useful just-above-relay dust. Outside of bumpfee previous to this PR, and manually creating such an output, the wallet will never make change outputs of that size, preferring to send them to fees instead. "Worst case" for the user is that users pay a slightly higher feerate than they were expecting, which is already a possibility with relay dust. Tree-SHA512: dd69351810dc1709437602e7db1be46e4e905ccd8e16d03952de8b4c1fdbf9cb7e6c99968930896baf6b5c7cb005a03ec0506a2669d22e21e32982e60329606b
2018-04-10Make DummySignatureCreator a singletonPieter Wuille
2018-04-10Make BaseSignatureCreator a pure interfacePieter Wuille
2018-04-09Merge #11851: scripted-diff: Rename wallet database classesWladimir J. van der Laan
9b0f0c5 Add m_ prefix to WalletBatch::m_batch (Russell Yanofsky) 398c6f0 Update walletdb comment after renaming. (Russell Yanofsky) ea23945 scripted-diff: Rename wallet database classes (Russell Yanofsky) Pull request description: Scripted diff to rename some wallet classes. Motivated by discussion in https://github.com/bitcoin/bitcoin/pull/11687#discussion_r155354119 | Current | New | | ---------------- | ------------------- | | CDBEnv | BerkeleyEnvironment | | CDB | BerkeleyBatch | | CWalletDBWrapper | WalletDatabase | | CWalletDB | WalletBatch | Berkeley\* classes are intended to contain BDB specific code, while Wallet\* classes are intended to be more backend-agnostic. Also renamed associated variables: | Current | New | | ------------------- | --------------- | | dbw | database | | pwalletdb | batch | | pwalletdbEncryption | encrypted_batch | Tree-SHA512: 372f2e24b2deb59d4792b5ed578aaf0cce51b6db41c400bef5d0c2cd7833e62ae4d4afa0f6000268d52e15b20f737c5a55f1cecf7768556a782fd8cd6fe051d9
2018-04-09Logprint the start of a rescanJonas Schnelli
2018-04-09Remove duplicate includespracticalswift
2018-04-08Merge #12905: [rpcwallet] Clamp walletpassphrase value at 100M secondsMarcoFalke
2b2b96cd45 Use std::bind instead of boost::bind to re-lock the wallet (Suhas Daftuar) 662d19ff72 [rpcwallet] Clamp walletpassphrase value at 100M seconds (Suhas Daftuar) Pull request description: Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping). Tree-SHA512: 890f3b641f6c586e2f8f629a9d23bca6ceb8b237b285561aad488cb7adf941a21177d3129d0c2b8293c0a673cd8e401957dbe2b6b3b7c8c4e991bb411d260102
2018-04-08Use std::bind instead of boost::bind to re-lock the walletSuhas Daftuar
Change suggested by Marco Falke.
2018-04-08[rpcwallet] Clamp walletpassphrase value at 100M secondsSuhas Daftuar
Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping).
2018-04-08Merge #12891: [logging] add lint-logs.sh to check for newline termination.Wladimir J. van der Laan
d207207 [logging] add lint-logs.sh to check for newline termination. (John Newbery) 5c21e6c [logging] Comment all continuing logs. (John Newbery) Pull request description: Check that all calls to LogPrintf() are terminated by a newline, except those that are explicitly marked as 'continued' logs. Tree-SHA512: fe5162b2b2df1e8a4c807da87584fa9af97a6b8377e4090fe0caa136d90bf29a487a123cde94569bdce7101fee3478196d99aa13f1212e24bfe5f41c773604fc
2018-04-08Merge #12895: tests: Add note about test suite name uniqueness requirement ↵Wladimir J. van der Laan
to developer notes d1b622b tests: Add check for test suite name uniqueness in lint-tests.sh (practicalswift) dc8067b tests: Add note about uniqueness requirement for test suite names (practicalswift) 3ebfb2d tests: Avoid test suite name collision in wallet crypto_tests (MarcoFalke) Pull request description: * Add documentation: Add note about test suite name uniqueness requirement in developer notes * Add regression test: Update `lint-tests.sh` to make it check also for test suite name uniqueness Context: #12894 (`tests: Avoid test suite name collision in wallet crypto_tests`) Tree-SHA512: 3c8502db069ef3d753f534976a86a997b12bac539e808a7285193bf81c9dd8c1b06821c3dd1bdf870ab87722b02c8aa9574c62ace70c2a1b8091785cb8c9aace
2018-04-07Add m_ prefix to WalletBatch::m_batchRussell Yanofsky
2018-04-07Update walletdb comment after renaming.Russell Yanofsky
Text from https://github.com/bitcoin/bitcoin/pull/11851#issuecomment-350320608 by John Newbery <john@johnnewbery.com>.
2018-04-07scripted-diff: Rename wallet database classesRussell Yanofsky
-BEGIN VERIFY SCRIPT- sed -i 's/\<CWalletDBWrapper\>/BerkeleyDatabase/g' src/wallet/db.h src/wallet/db.cpp sed -i '/statuses/i/** Backend-agnostic database type. */\nusing WalletDatabase = BerkeleyDatabase\;\n' src/wallet/walletdb.h ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' ':(exclude)*dbwrapper*' test | xargs sed -i "s:\<$1\>:$2:g"; } ren CDBEnv BerkeleyEnvironment ren CDB BerkeleyBatch ren CWalletDBWrapper WalletDatabase ren CWalletDB WalletBatch ren dbw database ren m_dbw m_database ren walletdb batch ren pwalletdb batch ren pwalletdbIn batch_in ren wallet/batch.h wallet/walletdb.h ren pwalletdbEncryption encrypted_batch -END VERIFY SCRIPT-
2018-04-07[logging] Comment all continuing logs.John Newbery
Most logs should terminated with a '\n'. Some logs are built up over multiple calls to logPrintf(), so do not need a newline terminater. Comment all of these 'continued' logs as a linter hing.
2018-04-07Merge #12785: wallet: Initialize m_last_block_processed to nullptrWladimir J. van der Laan
f63bc5e wallet: Initialize m_last_block_processed to nullptr. Initialize fields where defined. (practicalswift) Pull request description: Initialize `m_last_block_processed` to `nullptr`. `m_last_block_processed` was introduced in 5ee31726360cbe343f5a1a50a5e440db736da5b7. Tree-SHA512: 6e4a807e5b02115cbd80460761056f2eb22043203212d88dd0cd44c28dc0abce30ab29b078ca2c612232e76af4886f4fdbf2b0ff75e2df19b4d1a801b236cc13
2018-04-06tests: Avoid test suite name collision in wallet crypto_testsMarcoFalke
2018-04-05wallet: Refactor to WalletInitInterface* const g_wallet_init_interfaceJoão Barbosa
2018-04-05wallet: Make WalletInitInterface and DummyWalletInit privateJoão Barbosa
2018-04-05wallet: Initialize m_last_block_processed to nullptr. Initialize fields ↵practicalswift
where defined.
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-05Merge #12887: [trivial] Add newlines to end of log messages.Wladimir J. van der Laan
5b10ab0 [trivial] Add newlines to end of log messages. (John Newbery) Pull request description: Log messages should terminate with a '\n', or the following log will be written to the same line without a timestamp. Fix a couple of cases where the message is not terminated with a \n. Tree-SHA512: 88677afe85c88ce9f58312430e8881916bd76bbc8cd353ff81c97b3de8356680503160992c0ef3ea192b4694e848e9ca2480dbc38fea1776903b3784497f1af6
2018-04-04[trivial] Add newlines to end of log messages.John Newbery
Log messages should terminate with a '\n', or the following log will be written to the same line without a timestamp. Fix a couple of cases where the message is not terminated with a \n.
2018-04-03[wallet] [rpc] [doc] importprivkey: hint about importmultiKarl-Johan Alm
2018-04-02Bugfix: Include <memory> for std::unique_ptrLuke Dashjr
2018-04-01Merge #12757: Clarify include guard naming conventionMarcoFalke
3bcc0059b8 Add lint-include-guards.sh which checks include guard consistency (practicalswift) 8fd6af89a0 Fix missing or inconsistent include guards (practicalswift) 8af65d96f4 Document include guard convention (practicalswift) Pull request description: * **Documentation**: Document include guard convention * **Fix**: Fix missing or inconsistent include guards * **Regression test**: Add `lint-include-guards.sh` which checks include guard consistency Tree-SHA512: 8171878f60fd08ccbea943a11e835195750592abb9d7ab74eaa4265ae7fac523b1da9d31ca13d6ab73dd596e49986bfb7593c696e5f39567c93e610165bc2acc
2018-04-01Merge #12719: tests: Add note about test suite naming convention in ↵MarcoFalke
developer-notes.md db983beba6 tests: Add lint-tests.sh which checks the test suite naming convention (practicalswift) 5fd864fe8a tests: Rename test suits not following the test suite naming convention (practicalswift) 7b4a296a71 tests: Add note about test suite naming convention (practicalswift) Pull request description: Changes: * Add note about test suite naming convention * Fix exceptions * Add regression test Rationale: * Consistent naming of test suites makes programmatic test running of specific tests/subsets of tests easier * Explicit is better than implicit Before this commit: ``` $ contrib/devtools/lint-tests.sh The test suite in file src/test/foo_tests.cpp should be named "foo_tests". Please make sure the following test suites follow that convention: src/test/blockchain_tests.cpp:BOOST_FIXTURE_TEST_SUITE(blockchain_difficulty_tests, BasicTestingSetup) src/test/prevector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup) src/wallet/test/coinselector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(coin_selection_tests, WalletTestingSetup) src/wallet/test/crypto_tests.cpp:BOOST_FIXTURE_TEST_SUITE(wallet_crypto, BasicTestingSetup) $ ``` After this commit: ``` $ contrib/devtools/lint-tests.sh $ ``` Tree-SHA512: 7258ab9a6b9b8fc1939efadc619e2f2f02cfce8034c7f2e5dc5ecc769aa12e17f6fb8e363817feaf15c026c5b958b2574525b8d2d3f6be69658679bf8ceea9e9
2018-03-31rpc: fix type mistmatch in listreceivedbyaddressjoemphilips
2018-03-29Merge #10762: [wallet] Remove Wallet dependencies from init.cppWladimir J. van der Laan
c7ec524 [wallet] Add dummy wallet init class (John Newbery) 49baa4a [wallet] Use global g_wallet_init_interface to init/destroy the wallet. (John Newbery) caaf972 [wallet] Create wallet init interface. (John Newbery) 5fb5421 [wallet] Move wallet init functions into WalletInit class. (John Newbery) Pull request description: This continues the work of #7965. This PR, along with several others, would remove the remaining dependencies from libbitcoin_server.a on libbitcoin_wallet.a. To create the interface, I've just translated all the old init.cpp wallet function calls into an interface class. I've not done any thinking about whether it makes sense to change that interface by combining/splitting those calls. This is a purely internal interface, so there's no problem in changing it later. Tree-SHA512: 32ea57615229c33fd1a7f2f29ebc11bf30337685f7211baffa899823ef74b65dcbf068289c557a161c5afffb51fdc38a2ee8180720371f64d433b12b0615cf3f
2018-03-27[wallet] Use global g_wallet_init_interface to init/destroy the wallet.John Newbery
This commit creates a global g_wallet_init_interface, which is created in bitcoind and bitcoin-qt. g_wallet_init_interface is used to init and destroy the wallet. This removes the dependency from init.cpp on the wallet library.
2018-03-27Merge #10742: scripted-diff: Use scoped enumerations (C++11, "enum class")Wladimir J. van der Laan
1f45e21 scripted-diff: Convert 11 enums into scoped enums (C++11) (practicalswift) Pull request description: Rationale (from Bjarne Stroustrup's ["C++11 FAQ"](http://www.stroustrup.com/C++11FAQ.html#enum)): > > The enum classes ("new enums", "strong enums") address three problems with traditional C++ enumerations: > > * conventional enums implicitly convert to int, causing errors when someone does not want an enumeration to act as an integer. > * conventional enums export their enumerators to the surrounding scope, causing name clashes. > * the underlying type of an enum cannot be specified, causing confusion, compatibility problems, and makes forward declaration impossible. > > The new enums are "enum class" because they combine aspects of traditional enumerations (names values) with aspects of classes (scoped members and absence of conversions). Tree-SHA512: 9656e1cf4c3cabd4378c7a38d0c2eaf79e4a54d204a3c5762330840e55ee7e141e188a3efb2b4daf0ef3110bbaff80d8b9253abf2a9b015cdc4d60b49ac2b914
2018-03-26[wallet] Move wallet init functions into WalletInit class.John Newbery
2018-03-26Merge #12699: [wallet] Shuffle transaction inputs before signingWladimir J. van der Laan
2fb9c1e shuffle selected coins before transaction finalization (Gregory Sanders) Pull request description: Currently inputs are ordered based on COutPoint ordering, which while doesn't leak additional internal wallet state, likely further fingerprints the wallet as a Core wallet to observers. Note: This slightly changed behavior of `fundrawtransaction` in that the newly-appended inputs will now be shuffled rather than in outpoint-order. This does not break API compatibility. Simple shuffling of the coins being returned will hopefully allow the wallet to blend in a bit more, in lieu of additional data to find what other wallets are doing, or another standard, ala @gmaxwell's suggested of ordering via scriptPubKey. Tree-SHA512: 70689a6eccf9fa7fc6e3d884f2eba4b482446a1e6128beff7a98f446d0c60f7966c5a6c55e9b0b3d73a9b539ce54889a26c7efe78ab7f34af386d5e4f3fa6df2
2018-03-23shuffle sendmany recipients ordering to shuffle tx outputsGregory Sanders
2018-03-22Merge #11536: Rename account to label where appropriateWladimir J. van der Laan
d2527bd Rename wallet_accounts.py test (Russell Yanofsky) 045eeb8 Rename account to label where appropriate (Russell Yanofsky) Pull request description: Rename account to label where appropriate This change only updates strings and adds RPC aliases, but should simplify the implementation of address labels in https://github.com/bitcoin/bitcoin/pull/7729, by getting renaming out of the way and letting that change focus on semantics. The difference between accounts and labels is that labels apply only to addresses, while accounts apply to both addresses and transactions (transactions have "from" and "to" accounts). The code associating accounts with transactions is clumsy and unreliable so we would like get rid of it. --- There is a rebased version of #7729 atop this PR at https://github.com/ryanofsky/bitcoin/commits/pr/label, see https://github.com/bitcoin/bitcoin/pull/7729#issuecomment-338417139. Tree-SHA512: b3f934e612922d6290f50137f8ba71ddfaea4485713c7d97e89400a8b73b09b254f9186dffa462c77f5847721f5af9852b5572ade5443d8ee95dd150b3edb7ff
2018-03-22Merge #12694: Actually disable BnB when there are preset inputsWladimir J. van der Laan
081bf54 Test that BnB is not used when there are preset inputs (Andrew Chow) 6ef9982 Actually disable BnB when there are preset inputs (Andrew Chow) Pull request description: We don't want to use BnB when there are preset inputs because there is some weirdness with making that work with using the KnapsackSolver as the fallback. Currently we say that we haven't used bnb when there are preset inputs, but we don't actually disable BnB. This fixes that. I thought this was done originally. I guess it got lost in a rebase somewhere. Tree-SHA512: 9792c0cdd0736866bddbed20f10b8050104955dc589fba49a0bd61a582ba491c921af2cdcc2269678b7b69275dad5fcf89c71b75c28733c7bacbe52e55891b9c
2018-03-22Fix missing or inconsistent include guardspracticalswift
2018-03-21Merge #12747: Fix typosMarcoFalke
d27327c79a Fix typos (practicalswift) Pull request description: Fix typos. Tree-SHA512: f0d13d991acdec0d3adc2f091cd00ccbdda6da3c7623dfb4cbf698bac9eb6b3d88c8ad121256a96cb130f8e97bf54892f3616da0e8dc833dcf713ca7949e2801
2018-03-21feebumper: discard change outputs below discard rateGregory Sanders
2018-03-21shuffle selected coins before transaction finalizationGregory Sanders