aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
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.
2021-12-03Merge bitcoin/bitcoin#23413: Replace MakeSpan helper with Span deduction guideMarcoFalke
11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3 More Span simplifications (Pieter Wuille) 568dd2f83900a11a4dbba1250722791a135bf0a9 Replace MakeSpan helper with Span deduction guide (Pieter Wuille) Pull request description: C++17 supports [user-defined deduction guides](https://en.cppreference.com/w/cpp/language/class_template_argument_deduction), allowing class constructors to be invoked without specifying class template arguments. Instead, the code can contain rules to infer the template arguments from the constructor argument types. This alleviates the need for the `MakeSpan` helper. Convert the existing MakeSpan rules into deduction rules for `Span` itself, and replace all invocations of `MakeSpan` with just `Span` ones. ACKs for top commit: MarcoFalke: re-ACK 11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3 Only change is removing a hunk in the tests 🌕 Tree-SHA512: 10f3e82e4338f39d9b7b407cd11aac7ebe1e9191b58e3d7f4e5e338a4636c0e126b4a1d912127c7446f57ba356c8d6544482e47f97901efea6a54fffbfd7895f
2021-12-03Merge bitcoin/bitcoin#23653: Generalize/simplify VectorReader into SpanReaderMarcoFalke
2c35a93b3cc19dc71d5664f9f61c24a04f419e35 Generalize/simplify VectorReader into SpanReader (Pieter Wuille) Pull request description: Originally written for #21590 (safegcd-based MuHash inverses), but then found a better way that removed the need for it, so I'm submitting it independently. ACKs for top commit: MarcoFalke: re-ACK 2c35a93b3cc19dc71d5664f9f61c24a04f419e35 🖨 shaavan: ACK 2c35a93b3cc19dc71d5664f9f61c24a04f419e35 Tree-SHA512: 959e3251e0cfe20e13a50639b617c9dc2a561d613a0884d983c93d15dacb6d2305d760aa933d18ba055cef8a1651a344bcb6b3f93051ecf26d3f2efc5779efa4
2021-12-03MOVEONLY: Move LoadWalletHelper to wallet/rpc/utilSamuel Dobson
2021-12-03MOVEONLY: Move wallet encryption RPCs to encrypt.cppSamuel Dobson
2021-12-03MOVEONLY: Move backupwallet and restorewallet to rpc/backup.cppSamuel Dobson
2021-12-03MOVEONLY: Move rpcdump.cpp to wallet/rpc/backup.cppSamuel Dobson
2021-12-02Generalize/simplify VectorReader into SpanReaderPieter Wuille
2021-12-02Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving ↵W. J. van der Laan
destinations to the address book 3d71d16d1eb4173c70d4c294559fc2365e189856 test: listtranscations with externally generated addresses (S3RK) d04566415e16ae685af066384f346dff522c068f Add to spends only transcations from me (S3RK) 9f3a622b1cea37e452560f2f82d8e82d3b48a73a Automatically add labels to detected receiving addresses (S3RK) c1b99c088c54eb101c0a28a67237965576ccf5ad Return used destinations from ScriptPubKeyMan::MarkUnusedAddresses (S3RK) 03840c20640685295a65ed8c82456e877f668b9b Add CWallet::IsInternalScriptPubKeyMan (S3RK) 456e350926adde5dabdbc85fc0f017fb29bdadb3 wallet: resolve ambiguity of two ScriptPubKey managers providing same script (S3RK) Pull request description: This PR fixes certain use-cases when **send-to-self** transactions are missing from `listtransactions` output. 1. When a receiving address is generated externally to the wallet (e.g. same wallet running on two nodes, or by 3rd party from xpub) 2. When restoring backup with lost metadata, but keypool gap is not exceeded yet When the block is connected or tx added to mempool we already mark used keys. This PR extends this logic to determine whether the destination is a receiving one and if yes add it to the address book with empty label. Works both for legacy and descriptors wallets. - For legacy it uses the internal flag from the keypool entry. Caveat: because we don't know which script type would be used we add all possible destinations for such keys. - For descriptor wallets it uses internal flag for the script pub key manager. Caveat: it only works for active descriptors. fixes #19856 fixes #20293 ACKs for top commit: laanwj: Code review ACK 3d71d16d1eb4173c70d4c294559fc2365e189856 Tree-SHA512: 03fafd5548ead0c4ffe9ebcc9eb2849f1d2fa7270fda4166419b86877d4e57dcf04460e465fbb9c90b42031f3c05d1b83f1b67a9f82c2a42980825ed1e7b52e6
2021-12-02Merge bitcoin/bitcoin#23640: MOVEONLY: Move helper functions from rpcwallet ↵MarcoFalke
to wallet/rpc/util ff945e553affbb7e25da1257a0dd47e413ec5164 MOVEONLY: Move utility functions from rpcwallet to wallet/rpc/util (Samuel Dobson) 7b04a064f6e8ee9d93e5a5ad54dab20b769083f2 Introduce wallet/rpc/util (Samuel Dobson) Pull request description: This is part one of multiple to split up rpcwallet.cpp into smaller, more logical units. See #23622 for context and overall plan. I'll open PRs in stages to hopefully minimise conflicts. Can be reviewed with `--color-moved=dimmed-zebra` The end goal can be seen here: https://github.com/meshcollider/bitcoin/tree/202111_split_walletrpc ACKs for top commit: MarcoFalke: nice, ACK ff945e553affbb7e25da1257a0dd47e413ec5164 🐰 shaavan: ACK ff945e553affbb7e25da1257a0dd47e413ec5164 Tree-SHA512: 6e3d1de6db770fe2fca540c8c4f30183ab8258c26e3a1fb46937714d28818a52933eafbfcafe2995f6a6e2551a3f3dd3ec93363b81de7912c0d81f5749d1c86d