aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2021-12-21wallet: add taprootEnabled() to interfaceSjors Provoost
2021-12-20Merge bitcoin/bitcoin#23341: RPC: Better safety with newkeypool command and ↵Andrew Chow
wallet backups a2a92317ad4ab88cfca234f68337a7cd37897f10 rpc: Add warning to user about newkeypool command (Samuel Dobson) Pull request description: This PR prevents `newkeypool` from being run on non-HD wallets, because this would require a new backup every time, so it isn't very safe. David Harding also suggested [here](https://github.com/bitcoin/bitcoin/pull/23093#issuecomment-945350003) that the RPC help text should include a warning to the users about the interaction between newkeypool. ACKs for top commit: achow101: ACK a2a92317ad4ab88cfca234f68337a7cd37897f10 Tree-SHA512: 0aa497900f1d179764bce13ffce0bb081ba2ca354492bf2e04b21d0212e960b3ed13a386fbf65602b6b50461f4056a0285752ef707d312da28e82449cd8ea048
2021-12-17wallet: Strictly match tx change type to improve privacyMarcoFalke
2021-12-16Merge bitcoin/bitcoin#23750: rpcwallet: mention labels are disabled for ↵MarcoFalke
ranged descriptors 65efbba45d817261f590d043c69a9981e6b637bd rpcwallet: mention labels are deactivated for ranged descriptors (Antoine Poinsot) Pull request description: It was confusing when trying to use it as a blackbox. So mention it so next ones don't have to open the said box :) See #23749 for context ACKs for top commit: Sjors: utACK 65efbba45d817261f590d043c69a9981e6b637bd achow101: ACK 65efbba45d817261f590d043c69a9981e6b637bd Tree-SHA512: d8a3d1f81c16d95855ac2b01e8fd20e83d6dac1721b3da464a9a890e46102992a6882918be87b2a28b929349ee7f1beb1af6c88b22f065fbbb6948275a6d2b8f
2021-12-16Merge bitcoin/bitcoin#23721: wallet, refactor: Move restorewallet() logic to ↵MarcoFalke
the wallet section 62fa61fa4a33ff4d108a65d656ffe2cac4330824 refactor: remove the wallet folder if the restore fails (w0xlt) abbb7eccef3fc1c36f34756458d2792f6661e29f refactor: Move restorewallet() RPC logic to the wallet section (w0xlt) 4807f73f48f4ff1084fcf7aee94e5b14592bfda8 refactor: Implement restorewallet() logic in the wallet section (w0xlt) Pull request description: Currently `restorewallet()` logic is written in the RPC layer and it can´t be reused by GUI. So it moves this to the wallet section and then, GUI can access it. This is necessary to implement the "Restore Wallet" menu item in the GUI (which is already implemented in https://github.com/bitcoin-core/gui/pull/471 ). This commit also simplifies error handling and adds a new behavior: if the restore fails, the invalid wallet folder is removed. ACKs for top commit: achow101: ACK 62fa61fa4a33ff4d108a65d656ffe2cac4330824 shaavan: crACK 62fa61fa4a33ff4d108a65d656ffe2cac4330824 Tree-SHA512: 7ccfbad5943f38616ba0c2dd443c97a4b5bc1f6612dbf5a9e7a0263100aba36671fae929a2e7688442667be394645f44484af137a4802f204a33c4689eb27c39
2021-12-15refactor: remove the wallet folder if the restore failsw0xlt
2021-12-15refactor: Move restorewallet() RPC logic to the wallet sectionw0xlt
It also simplifies restorewallet() and loadwallet() RPC error handling.
2021-12-14refactor: Implement restorewallet() logic in the wallet sectionw0xlt
Currently restorewallet() logic is written in the RPC layer and it can´t be reused by GUI. So it reimplements this in the wallet and interface sections and then, GUI can access it.
2021-12-13wallet: Replace Assume with Assert where needed in coinselectionMarcoFalke
2021-12-12rpcwallet: mention labels are deactivated for ranged descriptorsAntoine Poinsot
2021-12-12rpc: Add warning to user about newkeypool commandSamuel Dobson
2021-12-11Merge bitcoin/bitcoin#23113: Add warnings to createmultisig and addmultisig ↵MarcoFalke
if using uncompressed keys d5cab1a96d26e66d342fb5ec35c809bb82869d00 Add createmultisig and addmultisigaddress warnings release note (Samuel Dobson) e46fc935aa6eb392ef9411dad310697aba601f6a Add warnings field to addmultisigaddress to warn about uncompressed keys (Samuel Dobson) d1a9742623e2a8f3307c84c2df6993f62617a6f6 Add warnings field to createmultisig to warn about uncompressed keys (Samuel Dobson) Pull request description: Fixes #21368 Currently, if there are any uncompressed keys when calling `AddAndGetMultisigDestination`, it will just default to a legacy address regardless of the chosen `address_type`. Rather than keeping this silent behaviour which may be confusing to users, we explicitly add a `warnings` field which will warn the user why their address format is different. ACKs for top commit: achow101: ACK d5cab1a96d26e66d342fb5ec35c809bb82869d00 Tree-SHA512: c2ac7f7689251bd4fcd8c26506f053921fbaf34c7a26a74e82ebc7f82cc0bd25407fd7954bf98365dcafa51fa45dcdbee6214320580ca69509690c3555e71cc0
2021-12-10Merge bitcoin/bitcoin#22514: psbt: Actually use SIGHASH_DEFAULT for PSBT signingMarcoFalke
c0405ee27fa23a9868f04c052bdc94d7accc57e2 rpc: Document that DEFAULT is for Taproot, ALL for everything else (Andrew Chow) d3992669df826899a3de78a77a366dab46028026 psbt: Actually use SIGHASH_DEFAULT (Andrew Chow) eb9a1a2c595a03475fd4275b104676b7e2200f07 psbt: Make sighash_type std::optional<int> (Andrew Chow) Pull request description: Make the behavior align with the help text by actually using SIGHASH_DEFAULT as the default sighash for signing PSBTs. ACKs for top commit: Sjors: re-utACK c0405ee27fa23a9868f04c052bdc94d7accc57e2 Tree-SHA512: 5199fb41de416b2f10ac451f824e7c94b428ba11fdb9e50f0027c692e959ce5813a340c34a4e52d7aa128e12008303d80939a693eff36a869720e45442119828
2021-12-10Merge bitcoin/bitcoin#23628: Check descriptors returned by external signersfanquake
5493e925013245d5ad0f7ea8784fe07f531803d0 Check descriptors returned by external signers (sstone) Pull request description: Check that descriptors returned by external signers have been parsed properly when creating a new wallet. See https://github.com/bitcoin/bitcoin/issues/23627 for context. The problem is that parsing an invalid descriptor will return `null` which is not checked for in `CWallet::SetupDescriptorScriptPubKeyMans()`. I'm not completely sure what the best fix is since there several strategies for dealing with errors in the current codebase but the proposed fix is very simple and consistent with other validation checks in `CWallet::SetupDescriptorScriptPubKeyMans()`. ACKs for top commit: jamesob: Code review ACK https://github.com/bitcoin/bitcoin/pull/23628/commits/5493e925013245d5ad0f7ea8784fe07f531803d0 achow101: ACK 5493e925013245d5ad0f7ea8784fe07f531803d0 Tree-SHA512: 63259f4aa519405a86c554b6813efdb741314bdaa18bf005b70ea8bb92a27abc6e2b65f7c584641dc257fc78a6499f42b51b5310c243e611c4663430dccf3d04
2021-12-09Merge bitcoin/bitcoin#22019: wallet: Introduce SelectionResult for ↵W. J. van der Laan
encapsulating a coin selection solution 05300c14392facf38330eb4fcd8e695a838b76f3 Use SelectionResult in SelectCoins (Andrew Chow) 9d9b101d2019d8237546eedd022e74519feb07bb Use SelectionResult in AttemptSelection (Andrew Chow) bb50850a447bdf461ffb76d47d4a4db904fce324 Use SelectionResult for waste calculation (Andrew Chow) e8f7ae5eb3c682d1a80b503f71e06ce76af1b65c Make an OutputGroup for preset inputs (Andrew Chow) 51a9c00b4de707e0a6a1a68ca6f8e38d86c72d94 Return SelectionResult from SelectCoinsSRD (Andrew Chow) 0ef6184575e77b17f5ec6d7ca086900aca79f6d7 Return SelectionResult from KnapsackSolver (Andrew Chow) 60d2ca72e3f4c56433c63b929a88e7a2def06399 Return SelectionResult from SelectCoinsBnB (Andrew Chow) a339add471717623915cd1a846ade4dab2c89deb Make member variables of SelectionResult private (Andrew Chow) cbf0b9f4ff438865a71c7ceb0a543c18a34f41f0 scripted-diff: Use SelectionResult in coin selector tests (Andrew Chow) 9d1d86da04d5d4768975338841285e90b01130b8 Introduce SelectionResult struct (Andrew Chow) 94d851d28cb909a8f1f8ab795f1d9fc74bebfc7f Fix bnb_search_test to use set equivalence for (Andrew Chow) Pull request description: Instead of returning a set of selected coins and their total value as separate items, encapsulate both of these, and other variables, into a new `SelectionResult` struct. This allows us to have all of the things relevant to a coin selection solution be in a single object. `SelectionResult` enables us to implement the waste calculation in a cleaner way. All of the coin selection functions (`SelectCoinsBnB`, `KnapsackSolver`, `AttemptSelection`, and `SelectCoins`) are changed to use a `SelectionResult` as the output parameter. Based on #22009 ACKs for top commit: laanwj: Code review ACK 05300c14392facf38330eb4fcd8e695a838b76f3 Tree-SHA512: e4dbb4d78a6cda9c237d230b19e7265591efac5a101a64e6970f0654e2c4f93d13bb5d07b98e8c7b8d37321753dbfc94c28c3a7810cb1c59b5bc29b08a8493ef
2021-12-09Merge bitcoin/bitcoin#23346: util, refactor: Improve headers for ↵MarcoFalke
bitcoin-wallet tool 3431839c33fa3892c982322e4add39e28ddba719 util, refactor: Improve headers for bitcoin-wallet tool (Hennadii Stepanov) Pull request description: This PR: - removes unneeded `#include <wallet/wallet.h>` from `<wallet/wallettool.h>` - introduces class forward declaration in `<wallet/wallettool.h>` - added `#include <config/bitcoin-config.h>` to `wallet/wallettool.cpp` where the `USE_BDB` macro is used Top commit has no ACKs. Tree-SHA512: a0de560d821f8b570ae806a1165b9b382c9e0b339687d932052fa4c38ab2ba493e7e050f19adc02ad7db40c42cf88ac1d37209f9071494a0ab268ed33ff22b9f
2021-12-09Check descriptors returned by external signerssstone
Check that descriptors returned by external signers have been parsed properly when creating a new wallet.
2021-12-09Merge bitcoin/bitcoin#23703: scripted-diff: Use named args in RPC docsfanquake
fa9aaf8694c63200ad01fd5659aba4f409b2c3b9 scripted-diff: Use named args in RPC docs (MarcoFalke) Pull request description: Incorrect named args are source of bugs, like #22979. To allow them being checked by `clang-tidy`, use a format it can understand. ACKs for top commit: fanquake: ACK fa9aaf8694c63200ad01fd5659aba4f409b2c3b9 - checked `clang-tidy` and it's fine here, (but throwing errors in other files. i.e `wallet/test/wallet_tests.cpp`). Tree-SHA512: e09dae8ee999a5c4819e6f848c12139593ca0e915e645c8fabeb97c379188fb9104d286c02c71f590abc64cdec125f78026735f83e016111976baa49d588a9bc
2021-12-08rpc: Document that DEFAULT is for Taproot, ALL for everything elseAndrew Chow
2021-12-08psbt: Actually use SIGHASH_DEFAULTAndrew Chow
Make the behavior align with the help text by actually using SIGHASH_DEFAULT as the default sighash for signing PSBTs.
2021-12-08psbt: Make sighash_type std::optional<int>Andrew Chow
It is better to ues an optional to determine whether the sighash type is set rather than using 0 as a magic number.
2021-12-08scripted-diff: Use named args in RPC docsMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i -e 's|, /\* optional \*/ true,|, /*optional=*/true,|g' $( git grep -l ', /\* optional \*/ true,' ) -END VERIFY SCRIPT-
2021-12-08Merge bitcoin/bitcoin#23254: doc: Fix typo and grammarSamuel Dobson
ffd11ea87640c8a3d83b6f83ac18e65234fc6002 Fix typo and grammar (Heebs) Pull request description: Fix typo and grammar in the coin selection algorithm's description. ACKs for top commit: meshcollider: ACK ffd11ea87640c8a3d83b6f83ac18e65234fc6002 Tree-SHA512: bba07c2efd5140fb3e021618739d70aaa761bbc274afb8158809492b0606773c217e42e58e58b18a2454b9c45ebc883ebece17cdc467ac60e3d3140d7a979db7
2021-12-08Add warnings field to addmultisigaddress to warn about uncompressed keysSamuel Dobson
2021-12-08MOVEONLY: Move abortrescan from backup.cpp to transactions.cppSamuel Dobson
2021-12-08Remove unused imports from rpc/wallet and reorder RPCsSamuel Dobson
2021-12-08MOVEONLY: Move rpcwallet to rpc/walletSamuel Dobson
2021-12-08MOVEONLY: Move spending RPCs to spend.cppSamuel Dobson
2021-12-08MOVEONLY: Move balance and utxo RPCs to coins.cppSamuel Dobson
2021-12-08MOVEONLY: Move address related functions from rpcwallet to addresses.cppSamuel Dobson
2021-12-08MOVEONLY: Move transaction related wallet RPCs to transactions.cppSamuel Dobson
2021-12-07Merge bitcoin/bitcoin#14707: [RPC] Include coinbase transactions in ↵MarcoFalke
receivedby RPCs 1dcba996d30d83aebe8c73f42f5d4056d6472166 Coinbase receivedby rpcs release notes (Andrew Toth) b5696750a925c07261287b043ffdfb393cbb1327 Test including coinbase transactions in receivedby wallet rpcs (Andrew Toth) bce20c34d6b999e700a560f95351c212ed8c36f4 Include coinbase transactions in receivedby wallet rpcs (Andrew Toth) Pull request description: The current `*receivedby*` RPCs filter out coinbase transactions. This doesn't seem correct since an output to your address in a coinbase transaction *is* receiving those coins. This PR corrects this behaviour. Also, a new option `include_immature_coinbase` is added (default=`false`) that includes immature coinbase transactions when set to true. However, since this is potentially a breaking change this PR introduces a hidden configuration option `-deprecatedrpc=exclude_coinbase`. This can be set to revert to previous behaviour. If no reports of broken workflow are received, then this option can be removed in a future release. Fixes https://github.com/bitcoin/bitcoin/issues/14654. ACKs for top commit: jnewbery: reACK 1dcba996d30d83aebe8c73f42f5d4056d6472166 Tree-SHA512: bfc43b81279fea5b6770a4620b196f6bc7c818d221b228623e9f535ec75a2406bc440e3df911608a3680f11ab64c5a4103917162114f5ff7c4ca8ab07bb9d3df
2021-12-07Merge bitcoin/bitcoin#20583: rpc: Add missing BlockUntilSyncedToCurrentChain ↵MarcoFalke
to wallet RPCs fa5362a9a0c5665c1a4de51c3ce4758c93a9449e rpc: Add missing BlockUntilSyncedToCurrentChain to wallet RPCs (MarcoFalke) Pull request description: Wallet RPCs that allow a rescan based on block-timestamp or block-height need to sync with the active chain first, because the user might assume the wallet is up-to-date with the latest block they got reported via a blockchain RPC. ACKs for top commit: meshcollider: utACK fa5362a9a0c5665c1a4de51c3ce4758c93a9449e Tree-SHA512: d4831f1f08f854f9a49fc969de86c438f856e41c2163c801a6ff36dc2f6299cb342b44663279c524a8b7ca9a50895db1243cd7d49bed79277ada857213f20a26
2021-12-07Merge bitcoin/bitcoin#23687: Remove unused (and broken) functionality in ↵MarcoFalke
SpanReader 31ba1af74a0aaec690a01ea061264a6d5039d885 Remove unused (and broken) functionality in SpanReader (Pieter Wuille) Pull request description: This removes the ability to set an offset in the `SpanReader::SpanReader` constructor, as the current code is broken since #23653. All call sites use `pos=0`, so it is actually unused. If future call sites need it, `SpanReader{a, b, c, d}` is equivalent to `SpanReader{a, b, c.subspan(d)}`. It also removes the ability to deserialize from `SpanReader` directly from the constructor. This too is unused, and can be more idiomatically simulated using `(SpanReader{a, b, c} >> x >> y >> z)` instead of `SpanReader{a, b, c, x, y, z}`. This was pointed out by achow101 in https://github.com/bitcoin/bitcoin/pull/23653#discussion_r763370432. ACKs for top commit: jb55: crACK 31ba1af74a0aaec690a01ea061264a6d5039d885 achow101: ACK 31ba1af74a0aaec690a01ea061264a6d5039d885 Tree-SHA512: 700ebcd74147628488c39168dbf3a00f8ed41709a26711695f4bf036250a9b115574923bbf96040ec7b7fee4132d6dbbcb5c6e5a2977c4beb521dc1500e6ed53
2021-12-07Merge bitcoin/bitcoin#23676: rpc: correct ↵MarcoFalke
`getnewaddress`/`getrawchangeaddress` address_type helptext 576720850467b7b21ca1ab59deab27b7a0c1c176 correct rpc address_type helptext (brianddk) Pull request description: RPC calls `getnewaddress`/`getrawchangeaddress` support the address_type of `bech32m` but it is omitted in the `RPCHelpMan` help text. The `createmultisig` and `addmultisigaddress` help text was not updated since `bech32m` is not yet supported in these. ACKs for top commit: shaavan: ACK 576720850467b7b21ca1ab59deab27b7a0c1c176 Tree-SHA512: 3c0cfb96019ca6d316c4a2fe27786d1b621c49b31b3aa61068bad737a5a0ceed89babad704b9923f9aedcabfa670d752916803bdf22236403061ddf9295a2637
2021-12-07Merge bitcoin/bitcoin#23644: wallet: Replace confusing getAdjustedTime() ↵MarcoFalke
with GetTime() fa37e798b2660d8e44e31c944a257b55aeef5de2 wallet: Replace confusing getAdjustedTime() with GetTime() (MarcoFalke) Pull request description: Setting `nTimeReceived` to the adjusted time has several issues: * `m_best_block_time` is set to the "unadjusted" time, thus a comparison of the two times is like comparing apples to oranges. In the worst case this opens up an attack vector where remote peers can force a premature re-broadcast of wallet txs. * The RPC documentation for `"timereceived"` doesn't mention that the network adjusted time is used, possibly confusing users when the time reported by RPC is off by a few seconds compared to their local timestamp. Fix all issues by replacing the call with `GetTime()`. Also a style fix: Use non-narrowing integer conversion in the RPC method. ACKs for top commit: theStack: Code-review ACK fa37e798b2660d8e44e31c944a257b55aeef5de2 shaavan: crACK fa37e798b2660d8e44e31c944a257b55aeef5de2 Tree-SHA512: 8d020ba400521246b7aed4b6c41319fc70552e8c69e929a5994500375466a9edac02a0ae64b803dbc6695df22276489561a23bd6e030c44c97d288f7b9b2b3fa
2021-12-06Remove unused (and broken) functionality in SpanReaderPieter Wuille
This removes the ability to set an offset in the SpanReader constructor, as the current code is broken. All call sites use pos=0, so it is actually unused. If future call sites need it, SpanReader{a, b, c, d} is equivalent to SpanReader{a, b, c.subspan(d)}. It also removes the ability to deserialize from SpanReader directly from the constructor. This too is unused, and can be more idiomatically simulated using (SpanReader{a, b, c} >> x >> y >> z) instead of SpanReader{a, b, c, x, y, z}.
2021-12-06Include coinbase transactions in receivedby wallet rpcsAndrew Toth
2021-12-05Use SelectionResult in SelectCoinsAndrew Chow
Replace setCoinsRet and nValueRet with SelectionResult
2021-12-05Use SelectionResult in AttemptSelectionAndrew Chow
Replace setCoinsRet and nValueRet with a SelectionResult in AttemptSelection
2021-12-05Use SelectionResult for waste calculationAndrew Chow
2021-12-05Make an OutputGroup for preset inputsAndrew Chow
In SelectCoins, for our preset inputs, we combine all of the preset inputs into a single OutputGroup. This allows us to combine the preset inputs with additional selection algo results.
2021-12-05Return SelectionResult from SelectCoinsSRDAndrew Chow
Changes SelectCoinsSRD to return a SelectionResult.
2021-12-05Return SelectionResult from KnapsackSolverAndrew Chow
Returns a std::optional<SelectionResult> from KnapsackSolver instead of using out parameters for the inputs set and selected value.
2021-12-05Return SelectionResult from SelectCoinsBnBAndrew Chow
Removes coins_out and value_ret has SelectCoinsBnB return a std::optional<SelectionResult>
2021-12-05Make member variables of SelectionResult privateAndrew Chow
2021-12-05scripted-diff: Use SelectionResult in coin selector testsAndrew Chow
Replace the CoinSet actual_selection with a SelectionResult expected_result. We don't use the SelectionResult functions yet, but will soon. -BEGIN VERIFY SCRIPT- sed -i 's/CoinSet actual_selection/SelectionResult expected_result(CAmount(0))/' src/wallet/test/coinselector_tests.cpp sed -i 's/actual_selection/expected_result.m_selected_inputs/' src/wallet/test/coinselector_tests.cpp sed -i 's/expected_result.m_selected_inputs.clear/expected_result.Clear/' src/wallet/test/coinselector_tests.cpp -END VERIFY SCRIPT-
2021-12-05Introduce SelectionResult structAndrew Chow
Introduces a SelectionResult struct which contains the set of selected inputs and the total transaction fee for the transaction. This will be used by the various SelectCoins* functions. Additionally helpers are provided to compute the total input value and result comparisons.
2021-12-04correct rpc address_type helptextbrianddk
added address_type of `bech32m` to rpc calls `getnewaddress`/`getrawchangeaddress`
2021-12-03rpc: Add missing BlockUntilSyncedToCurrentChain to wallet RPCsMarcoFalke
Wallet RPCs that allow a rescan based on block-timestamp or block-height need to sync with the active chain first, because the user might assume the wallet is up-to-date with the latest block they got reported via a blockchain RPC.