aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2019-03-11Move BerkeleyEnvironment deletion from internal method to callsiteAndrew Chow
Instead of having the object destroy itself, having the caller destroy it. Github-Pull: #12493 Rebased-From: a769461
2019-03-11After encrypting the wallet, reload the database environmentAndrew Chow
Calls ReloadDbEnv after encrypting the wallet so that the database environment is flushed, closed, and reopened to prevent unencrypted keys from being saved on disk. Github-Pull: #12493 Rebased-From: d7637c5
2019-03-11Add function to close all Db's and reload the databae environmentAndrew Chow
Adds a ReloadDbEnv function to BerkeleyEnvironment in order to close all Db instances, closes the environment, resets it, and then reopens the BerkeleyEnvironment. Also adds a ReloadDbEnv function to BerkeleyDatabase that calls BerkeleyEnvironment's ReloadDbEnv. Github-Pull: #12493 Rebased-From: 5d296ac
2019-01-31Merge #15002: 0.17: Backport #14941Wladimir J. van der Laan
0cd9ad208c327127cc4616ccdc37557fad3cf381 rpc: Make unloadwallet wait for complete wallet unload (João Barbosa) Pull request description: #14941 makes `unloadwallet` a synchronous call meaning that it waits for the wallet to fully unload/delete. Tree-SHA512: df7a490306ee2cca399129a4ebfba4b19b65fe67d1657ec3518352fe453327cb347010f94cf7fe4a60aeb51c928cb9ad6b24c40123fd0b9dc0aab5920a59f48d
2019-01-25Remove errant past from walletcreatefundedpsbt for nLocktime replaceabilityGregory Sanders
Github-Pull: #15213 Rebased-From: 85f0ca95f3b57d9714a753882ea22fcd6a4139fb
2019-01-16rpc: Make unloadwallet wait for complete wallet unloadJoão Barbosa
Github-Pull: #14941 Rebased-From: c37851d
2018-12-24Merge #14893: 0.17 [Backport 14890] rpc: Avoid creating non-standard raw ↵MarcoFalke
transactions 46c162df47 rpc: Avoid creating non-standard raw transactions (MarcoFalke) Pull request description: Tree-SHA512: f34678637c8b6559e5c0c2790b682af562479239b92be96e0d41806bade136866f9748487a021eb8c62b6a5027b0a1a2cbdee930243eac93edabef60cbd54eac
2018-12-09importmulti: Don't add internal addresses to address bookGregory Sanders
Github-Pull: #14679 Rebased-From: 7afddfa8cefd01249ad59cf2370e7cec90b34f6f
2018-12-07rpc: Avoid creating non-standard raw transactionsMarcoFalke
Github-Pull: #14890 Rebased-From: fa4c8679ed94f215ce895938f7c3c169a2ce101e
2018-12-05rpc: Fix wallet unload during walletpassphrase timeoutJoão Barbosa
Github-Pull: #14453 Rebased-From: 321decf
2018-12-03Refactor PSBTInput signing to enforce invariantGlenn Willen
Refactor the process of PSBTInput signing to enforce the invariant that a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo, never both. This simplifies the logic of SignPSBTInput slightly, since it no longer has to deal with the "both" case. When calling it, we now give it, in order of preference: (1) whichever of the utxo fields was already present in the PSBT we received, or (2) if neither, the non_witness_utxo field, which is just a copy of the input transaction, which we get from the wallet. SignPSBTInput no longer has to remove one of the two fields; instead, it will check if we have a witness signature, and if so, it will replace the non_witness_utxo with the witness_utxo (which is smaller, as it is just a copy of the output being spent.) Add PSBTInput::IsSane checks in two more places, which checks for both utxo fields being present; we will now give an RPC error early on if we are supplied such a malformed PSBT to fill in. Also add a check to FillPSBT, to avoid touching any input that is already signed. (This is now redundant, since we should no longer potentially harm an already-signed input, but it's harmless.) fixes #14473 Github-Pull: #14588
2018-12-03Simplify arguments to SignPSBTInputGlenn Willen
Remove redundant arguments to SignPSBTInput -- since it needs several bits of the PartiallySignedTransaction, pass in a reference instead of doing it piecemeal. This saves us having to pass in both a PSBTInput and its index, as well as having to pass in the CTransaction. Also avoid redundantly passing the sighash_type, which is contained in the PSBTInput already. Github-Pull: #14588 Rebased-From: 0f5bda2bd941686620ef0eb90bd7ed973cc7ef73
2018-12-03New PartiallySignedTransaction constructor from CTransctionGlenn Willen
New constructor that creates a PartiallySignedTransaction from a CTransaction, automatically sizing the inputs and outputs vectors for convenience. Github-Pull: #14588 Rebased-From: 65166d4cf828909dc4bc49dd68a58103d015f1fd
2018-12-03Remove redundant txConst parameter to FillPSBTGlenn Willen
Github-Pull: #14588 Rebased-From: 4f3f5cb4b142f0fcb36241fa33b52a257901dbee
2018-12-03More concise conversion of CDataStream to stringGlenn Willen
Use .str() instead of .data() and .size() when converting CDataStream to a string. Uses std::string, avoiding conversion to a C string. Github-Pull: #14588 Rebased-From: fe5d22bc676f158e8d567d71edb3451118759d62
2018-12-01Merge #14196: [0.17][psbt] always drop the unnecessary utxo and convert ↵MarcoFalke
non-witness utxo to witness when necessary fcefc6851a Convert non-witness UTXOs to witness if witness sig created (Andrew Chow) fcdea8ad2a Drop the unnecessary UTXO based on the UTXOs present, not on earlier wallet things (Andrew Chow) Pull request description: When we sign an input in a psbt that has a non-witness utxo but a witness signature is produced, we will now replace the non-witness utxo with the corresponding witness utxo. Furthermore, we should make sure that the correct UTXO type is used based on what UTXOs are there, not based on earlier wallet behavior. Note that this is PR'd to the 0.17 branch because the code here no longer exists in master. Tree-SHA512: 882e9e4e9b77d6ac1743c35c0d59023aad6f4f19193398f97f2c6b81f6627d74e5220b1d674a0edba1ff2fc2a7f61afbf838d3faf0a964fccd3dee97c631aa47
2018-11-30CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown changeGregory Sanders
2018-11-30Remove stale comment in CalculateMaximumSignedInputSizeGregory Sanders
2018-11-28wallet: Avoid potential use of unitialized value bnb_used in ↵practicalswift
CWallet::CreateTransaction(...) Github-Pull: #13546 Rebased-From: a23a7f60aa07de52d23ff1f2034fc43926ec3520
2018-11-28[wallet] Ensure wallet is unlocked before signinggustavonalle
Github-Pull: #14310 Rebased-From: db15805668e923c3493d77122d20926496cf6a1a
2018-10-10[wallet] Restore ability to list incoming transactions by labelRussell Yanofsky
Backport of PR 14411 to v0.17. This change partially reverts #13075 and #14023. Fixes #14382
2018-09-11Convert non-witness UTXOs to witness if witness sig createdAndrew Chow
If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
2018-09-11Drop the unnecessary UTXO based on the UTXOs present, not on earlier wallet ↵Andrew Chow
things Instead of dropping the unnecessary UTXO based on whether the wallet did something, do it based on whether two UTXOs are there.
2018-08-28fix walletcreatefundedpsbt deriv paths, add testGregory Sanders
Github-Pull: #14055 Rebased-From: 61fe653bd919cb0533b2b9d6259bc86a4b2975c0 Tree-SHA512: 2f3edf62318fab4b405b47788096005f59cbe6ba4723fe51ce3b386539a58b7ea7369c31c3840c6baa76cdf6ba8f8440f977c36e2ee2916e711d7872bd1eadad
2018-08-27Docs: Fix help message typo optiona -> optionalBen Woosley
Github-Pull: #14056 Rebased-From: 7d0a8ad3103200145ab2e73368c3b8345a66c15d
2018-08-21RPCTypeCheck bip32derivs arg in walletcreatefundedGregory Sanders
Github-Pull: #13968 Rebased-From: faaac5caaab4d5131040292f4ef2404074ad268b Tree-SHA512: 758c0c3e4435897d1a9b03ea93f1b2a1a1b64071eda9450f968acf537c172ee61acf9d962bc22ddb6de26e0ad39d9165cdee6f260bb5a95bf97b4003853f0874
2018-08-21walletcreatefundedpsbt: remove duplicate replaceable argGregory Sanders
Github-Pull: #13968 Rebased-From: 1f18d7b591ffcc8bb9422a9b728bd9a0d8da6a2a Tree-SHA512: 90391703181db6880a135c60aca792a9e92c4abcad26907cd6cb0a0378593fe45cf995a22ae142ea7de2767c72a9df444e918ff15e460ce19c0435163917d812
2018-08-15Only wipe wrong UTXO type data if overwritten by walletPieter Wuille
GitHub-Pull: #13917 Rebased-From: c05712c
2018-08-13Merge #13666: Always create signatures with Low R valuesWladimir J. van der Laan
e306be742932d4ea5aca0ea4768e54b2fc3dc6a0 Use 72 byte dummy signatures when watching only inputs may be used (Andrew Chow) 48b1473c898129a99212e2db36c61cf93625ea17 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR (Andrew Chow) 18dfea0dd082af18dfb02981b7ee1cd44d514388 Always create 70 byte signatures with low R values (Andrew Chow) Pull request description: When creating signatures for transactions, always make one which has a 32 byte or smaller R and 32 byte or smaller S value. This results in signatures that are always less than 71 bytes (32 byte R + 32 byte S + 6 bytes DER + 1 byte sighash) with low R values. In most cases, the signature will be 71 bytes. Because R is not mutable in the same way that S is, a low R value can only be found by trying different nonces. RFC 6979 for deterministic nonce generation has the option to specify additional entropy, so we simply use that and add a uin32_t counter which we increment in order to try different nonces. Nonces are sill deterministically generated as the nonce used will the be the first one where the counter results in a nonce that results in a low R value. Because different nonces need to be tried, time to produce a signature does increase. On average, it takes twice as long to make a signature as two signatures need to be created, on average, to find one with a low R. Having a fixed size signature makes size calculations easier and also saves half a byte of transaction size, on average. DUMMY_SIGNATURE_CREATOR has been modified to produce 71 byte dummy signatures instead of 72 byte signatures. Tree-SHA512: 3cd791505126ce92da7c631856a97ba0b59e87d9c132feff6e0eef1dc47768e81fbb38bfbe970371bedf9714b7f61a13a5fe9f30f962c81734092a4d19a4ef33
2018-08-13Merge #13808: wallet: shuffle coins before grouping, where warrantedWladimir J. van der Laan
18f690ec2f7eb1b4aa51825bfed0cbfdadc93ac7 wallet: shuffle coins before grouping, where warranted (Karl-Johan Alm) Pull request description: Coins are randomly shuffled in coin selection to avoid unintentional privacy leaks regarding the user's coin set. For the case where a user has a lot of coins with the same destination, these will be grouped into groups of 10 *before* the shuffling. It is unclear whether this has any implications at all, but this PR plugs the potential issue, if there ever is one, by shuffling the coins before they are grouped. Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204554549 Tree-SHA512: fb50ed4b5fc03ab4853d45b76e1c64476ad5bcd797497179bc37b9262885c974ed6811159fd8e581f1461b6cc6d0a66146f4b70a2777c0f5e818d1322e0edb89
2018-08-10Merge #13908: [Docs] upgrade rescan time warning from minutes to >1 hourMarcoFalke
bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour (Mason Simon) Pull request description: When I rescanned just now it took well over an hour. The time warning "may take minutes" didn't prepare me for that. ``` 2018-08-08T03:10:17Z [wallet] Still rescanning. At block 174747. Progress=0.008341 2018-08-08T03:11:17Z [wallet] Still rescanning. At block 204233. Progress=0.024533 2018-08-08T03:12:17Z [wallet] Still rescanning. At block 221170. Progress=0.038340 ... 2018-08-08T04:16:17Z [wallet] Still rescanning. At block 524815. Progress=0.957105 2018-08-08T04:17:17Z [wallet] Still rescanning. At block 528572. Progress=0.971323 2018-08-08T04:18:17Z [wallet] Still rescanning. At block 532458. Progress=0.986824 ``` This is on a 4-core 4ghz system with a 7200rpm drive. Tree-SHA512: 722ccf566bfd6a3381fa173e08849cb676fe4c1f1cb2c4b86b07df2a5dc1ca0d54797cbe8fd606cdc2c60fef2be7c98e052460decdac2132ba759cff822132e8
2018-08-09Use 72 byte dummy signatures when watching only inputs may be usedAndrew Chow
With watching only inputs, we do not know how large the signatures for those inputs will be as their signers may not have implemented 71 byte signatures. Thus we estimate their fees using the 72 byte dummy signature to ensure that we pay enough fees. This only effects fundrawtransaction when includeWatching is true.
2018-08-09Use 71 byte signature for DUMMY_SIGNATURE_CREATORAndrew Chow
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures. Update comments to reflect this change
2018-08-10wallet: shuffle coins before grouping, where warrantedKarl-Johan Alm
Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257\#discussion_r204554549
2018-08-09Use pushKV in some new PSBT RPCs.Daniel Kraft
Most of the code uses UniValue::pushKV where appropriate, but some new RPC code related to PSBTs did not.
2018-08-09Merge #13911: doc: Revert translated string change, clarify wallet log messagesMarcoFalke
c4a884d555 Trivial: Revert translated string change, clarify wallet log messages (Pierre Rochard) Pull request description: Fixes https://github.com/bitcoin/bitcoin/pull/12992 post-merge nits from @jnewbery Tree-SHA512: 002d8a69b489fd216e15b7d6200d7117c489b32405d5e9f514f120d43113fd97ca2f235452b0093e0760bc03baf714edc4564ae14af8456e1b2a54f83c577bf3
2018-08-09Merge #13876: wallet: Catch filesystem_error and raise InitErrorMarcoFalke
fa8527ffec wallet: Catch filesystem_error and raise InitError (MarcoFalke) Pull request description: Fixes #13754 by restoring the previous behaviour Tree-SHA512: f64052e89f6b332be395df2a5ea6f227c213fa2f38e415e83f30a4fad0938e947e5cddff7902368a43c07be135955a31b90f7eac5a46875c58d54ea95f87f6e6
2018-08-08Trivial: Revert translated string change, clarify wallet log messagesPierre Rochard
2018-08-08Merge #13780: 0.17: Pre-branch maintenanceWladimir J. van der Laan
3fc20632a3ad30809356a58d2cf0ea4a4ad4cec3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot) 2b6a2f4a28792f2fe9dc1be843b1ff1ecae35e8a Regenerate manpages (DrahtBot) eb7daf4d600eeb631427c018a984a77a34aca66e Update copyright headers to 2018 (DrahtBot) Pull request description: Some trivial maintenance to avoid having to do it again after the 0.17 branch off. (The scripts to do this are in `./contrib/`) Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-07[Docs] upgrade rescan time warning from minutes to >1 hourMason Simon
2018-08-07Merge #13812: wallet: sum ancestors rather than taking max in output groupsWladimir J. van der Laan
23fbbb100f63cb621b4b901dac0c0f16d7d74bc7 wallet: sum ancestors rather than taking max in output groups (Karl-Johan Alm) Pull request description: This is pointed out in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204549758. Basically, the ancestors gives an indication as to how many ancestors the resulting transaction will have, which is more precise when summing up the values, rather than taking the maximum, since all the coins in the group will become ancestors if selected. Tree-SHA512: 0588c4b6059669650614817e041526a2ab89dda8c07fca8e077c7669dca1fed51cd164f7df56340840ab60285d48f3b140dcee64f64bf696b2dd4ab16d556a13
2018-08-07Merge #13843: [trivial] Add doxygen-compatible comments to CAffectedKeysVisitorWladimir J. van der Laan
3339d845354c9c357ec90505192748d9d639e72e [trivial] add doxygen-compatible comments to CAffectedKeysVisitor (Pierre Rochard) Pull request description: Tree-SHA512: 0003fde198a6977d0c8988efc8f76428f9e095009fddf131b07bd9809ef76a778c86bb2b1305e33df16101b6b703cf43eb6193462bb9f3687f98c1d9b109dd96
2018-08-07Merge #13657: wallet: assert to ensure accuracy of ↵Wladimir J. van der Laan
CMerkleTx::GetBlocksToMaturity 93de2891fa9cb8314573ba3a6ab764bc9c52444d wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity (Ben Woosley) Pull request description: According to my understanding, it should not be possible for coinbase transactions to be conflicting, thus it should not be possible for GetDepthInMainChain to return a negative result. If it did, this would also result in innacurate results for GetBlocksToMaturity due to the math therein. asserting ensures accuracy. Tree-SHA512: 8e71c26f09fe457cfb00c362ca27066f7f018ea2af1f395090fdc7fd9f5964b76f4317c23f7a4923776f00087558511da5c1c368095be39fb1bacc614a93c32f
2018-08-07Merge #13667: wallet: Fix backupwallet for multiwalletsWladimir J. van der Laan
a1a998cf24c0cf1232e44ec8eaf2ad6875ab5153 wallet: Fix backupwallet for multiwallets (Daniel Kraft) Pull request description: `backupwallet` was broken for multiwallets in their own directories (i.e. something like `DATADIR/wallets/mywallet/wallet.dat`). In this case, the backup would use `DATADIR/wallets/wallet.dat` as source file and not take the specific wallet's directory into account. This led to either an error during the backup (if the wrong source file was not present) or would silently back up the wrong wallet; especially the latter behaviour can be quite bad for users. Tree-SHA512: 7efe2450ca047e40719fcc7cc211ed94699056020ac737cada7b59e8240298675960570c45079add424d0aab520437d5050d956acd695a9c2452dd4317b4d2c4
2018-08-04wallet: Catch filesystem_error and raise InitErrorMarcoFalke
2018-08-03[trivial] add doxygen-compatible comments to CAffectedKeysVisitorPierre Rochard
2018-08-02[wallet] Add wallet name to log messagesPierre Rochard
After multiple wallets became supported, wallet-related log messages became ambiguous as to which wallet they were being emitted by. fixes #11317
2018-08-02trivial: correct typosVarunram
2018-08-01Merge #13805: [wallet] Correctly limit output group sizeMarcoFalke
a13647b8bd [qa] Add test for too-large wallet output groups (Suhas Daftuar) 57ec1c97b2 [wallet] correctly limit output group size (Suhas Daftuar) Pull request description: Also add a test to ensure that output groups are being limited, even if a wallet has many outputs corresponding to the same scriptPubKey (the test fails without the first commit). Tree-SHA512: 2aaa82005b0910488f5cbf40690d4c5e2f46949e299ef70b4cb6e440713811443d411dcbc6d71b1701fd82423073125e21747787d70830cd021c841afb732d51
2018-07-31wallet: sum ancestors rather than taking max in output groupsKarl-Johan Alm