aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
AgeCommit message (Collapse)Author
2019-06-21Make and get the multisig redeemscript and destination in one function ↵Andrew Chow
instead of two Instead of creating a redeemScript with CreateMultisigRedeemscript and then getting the destination with AddAndGetDestinationForScript, do both in the same function. CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination. It creates the redeemScript and returns it via an output parameter. Then it calls AddAndGetDestinationForScript to add the destination to the keystore and get the proper destination. This allows us to inspect the public keys in the redeemScript before creating the destination so that the correct destination is used when uncompressed pubkeys are in the multisig. Github-Pull: #16026 Rebased-From: a49503402b6bc21e3878e151c07529941d36aed0
2019-06-18scripted-diff: Replace fprintf with tfm::formatMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/fprintf\(std(err|out), /tfm::format(std::c\1, /g' $(git grep -l 'fprintf(' -- ':(exclude)src/crypto' ':(exclude)src/leveldb' ':(exclude)src/univalue' ':(exclude)src/secp256k1') -END VERIFY SCRIPT- fixup! scripted-diff: Replace fprintf with tfm::format Github-Pull: #16205 Rebased-From: fac03ec43a15ad547161e37e53ea82482cc508f9
2019-06-18Exceptions should be caught by reference, not by value.Kristaps Kaupe
Github-Pull: #16095 Rebased-From: ae7faf20d5fb3e2415ccadc37100dfc44aa0cd94
2019-06-18rpc: bugfix: Properly use iswitness in converttopsbtMarcoFalke
Also explain the param in all RPCs Github-Pull: #15899 Rebased-From: fa499b5f027f77c0bf13699852c8c06f78e27bef
2019-06-18rpc: Switch touched RPCs to IsValidNumArgsMarcoFalke
Github-Pull: #15899 Rebased-From: fa5c5cd141f0265a5693234690ac757b811157d8
2019-04-16Merge #15803: [0.18] Backport 15749: importmulti only imports origin info ↵MarcoFalke
for PKH outputs 235550d019 Take non-importing keys into account for spendability warning in descriptor import (Pieter Wuille) 802dcd37d1 Import all origin info in importmulti; even for non-importing pubkeys (Pieter Wuille) 7fcbe7dc11 Keep full pubkeys in FlatSigningProvider::origins (Pieter Wuille) Pull request description: Clean backport of #15749 by sipa to 0.18 ACKs for commit 235550: fanquake: utACK 235550d MarcoFalke: ACK 235550d019 (Checked that they are clean cherry-picks) Tree-SHA512: 1ccc19f51137ac4ef971c0bcca4c87ab2383610aa51c5d02680c485b9ce6abd698dddd7f4a45946d56b1aa741cc3fd94b4180ff15901824d20eeba89b4f12853
2019-04-16Take non-importing keys into account for spendability warning in descriptor ↵Pieter Wuille
import Github-Pull: #15749 Rebased-From: b5d39877242504160a7f2c24c60c07a845d7a064
2019-04-16Import all origin info in importmulti; even for non-importing pubkeysPieter Wuille
Github-Pull: #15749 Rebased-From: 6e597001a4fc1ba837f3f23cfd7f2d65c3d58104
2019-04-16Keep full pubkeys in FlatSigningProvider::originsPieter Wuille
Github-Pull: #15749 Rebased-From: 9a93c91c882265c908ea18496cd1bc271be914d4
2019-04-15Merge #15800: Backport: [rpc] Remove the addresses field from the ↵MarcoFalke
getaddressinfo return object b3a04c963d [rpc] Remove the addresses field from the getaddressinfo return object (John Newbery) Pull request description: Backport #15750 ACKs for commit b3a04c: MarcoFalke: ACK b3a04c963d4e761b66a1a8c1aae1c835534e47eb (checked cherry-pick) Tree-SHA512: d6e586fb6e22b9825267d6c45dd3090b7f8dc1a06804ca238103d1c665b178f8c2b3004f67aae67ea51c2c3df97561894f3f2e85d45400c760c3b7f057ff4bb8
2019-04-15[rpc] Remove the addresses field from the getaddressinfo return objectJohn Newbery
The "addresses" field was confusing because it refered to public keys using their P2PKH address. It was included in the return object when needed for backward compatibility. Remove that compatibility now that the -deprecatedrpc=validateaddress option has been removed. New applications should use the 'embedded'->'address' field for P2SH or P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig participants. Github-Pull: 15750 Rebased-From: b4338c151d4788c33f4b7c54daaf7f94b193a624
2019-04-01wallet: Update transactions with current mempool after loadJoão Barbosa
Github-Pull: #15652 Rebased-From: 2ebf650b2eb7a078ab60c8c4d5c726823686f549
2019-04-01wallet: Move CWallet::ReacceptWalletTransactions locks to callersJoão Barbosa
Github-Pull: #15652 Rebased-From: 0440481c6bf5683eff669c789bdf6a306d99adc5
2019-03-14wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtreeJoão Barbosa
Github-Pull: #15583 Rebased-From: 15c69b158da570f4e1430280c610e94ffdee0e51 Tree-SHA512: edef7cafc5a2cb8d3355591a7742ef61454a5dedbb1dc22f6cc6bae42329d887f3f4a054f2aeedf31180051f50b6478d09e204066205699dabc0cb67b0ce4a96
2019-02-28Use stop/[start,stop] notation in importmulti desc rangePieter Wuille
2019-02-23wallet: Use fsbridge::ifstream to fix Windows path issueChun Kuan Lee
2019-02-22Merge #15408: Remove unused TransactionError constantsMarcoFalke
fa9b60c842 Remove unused TransactionError constants (MarcoFalke) Pull request description: Fixup to #14978, which introduced a bunch of unused enum values, such as `UNKNOWN_ERROR`, `ERROR_COUNT` and `TRANSACTION_ERR_LAST`. None of those have a meaning in the context of an `enum class`, where the compiler can infer if all cases have been covered in a switch-case. Also, move the global `::maxTxFee` back to the rpc caller, so it can be set on a per call basis (in the future). Tree-SHA512: 7f1e2d795f1c1278ecd54ddab2b92c2a862f3c637b482d1d008208925befa1c9dd4b3c4bb1bfcbc5ca4b66a41004aaf01ea96ea95236f944250b8a6cf99ff173
2019-02-17Use a single wallet batch for UpgradeKeyMetadataJonas Schnelli
2019-02-17Merge #15425: [Doc] add missing newline to listunspent help for witnessScriptWladimir J. van der Laan
d3661a3fd247e8fb3911e2f7256025de8b163aeb [Doc] add missing newline to witnessScript in listunspent help (David A. Harding) Pull request description: Tree-SHA512: 85bb9c693bac36da0239eb6a1f42c2173d0170d5ff3d4c2fcd8897cfab233ef8c8ebc1eb5591e3dc89d091fde221d77c872f14a1eec201fee4dc83ba788390c3
2019-02-16[Doc] importmulti: add missing description of keypool optionDavid A. Harding
2019-02-16[Doc] add missing newline to witnessScript in listunspent helpDavid A. Harding
2019-02-15Make descriptor checksums mandatory in deriveaddresses and importmultiPieter Wuille
2019-02-14Import public keys in orderAndrew Chow
Do public key imports in the order that they are specified in the import or in the descriptor range.
2019-02-14Add option to importmulti add an imported pubkey to the keypoolAndrew Chow
Adds a new option to importmulti where the pubkeys specified in the import object can be added to the keypool. This only works if the wallet has private keys disabled.
2019-02-14Fetch keys from keypool when private keys are disabledAndrew Chow
When private keys are disabled, still fetch keys from the keypool if the keypool has keys. Those keys come from importing them and adding them to the keypool.
2019-02-14Add a method to add a pubkey to the keypoolAndrew Chow
Introduces AddKeypoolPubkey in order to add a pubkey to the keypool
2019-02-15Merge #14021: Import key origin data through descriptors in importmultiMeshCollider
cb3511b9d Add release notes for importing key origin info change (Andrew Chow) 4c75a69f3 Test importing descriptors with key origin information (Andrew Chow) 02d6586d7 Import KeyOriginData when importing descriptors (Andrew Chow) 3d235dff5 Implement a function to add KeyOriginInfo to a wallet (Andrew Chow) eab63bc26 Store key origin info in key metadata (Andrew Chow) 345bff601 Remove hdmasterkeyid (Andrew Chow) bac8c676a Add a method to CWallet to write just CKeyMetadata (Andrew Chow) e7652d3f6 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow) c45415f73 Refactor keymetadata writing to a separate method (Andrew Chow) Pull request description: This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet. In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this. Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
2019-02-14Import KeyOriginData when importing descriptorsAndrew Chow
2019-02-14Implement a function to add KeyOriginInfo to a walletAndrew Chow
2019-02-14Store key origin info in key metadataAndrew Chow
Store the master key fingerprint and derivation path in the key metadata. hdKeypath is kept to indicate the seed and for backwards compatibility, but all key derivation path output uses the key origin info instead of hdKeypath.
2019-02-14Merge #14481: Add P2SH-P2WSH support to listunspent RPCWladimir J. van der Laan
6ca836ab3abef5a90df0c3c4e4983f328b1afe00 Add release note for listunspent P2WSH change (MeshCollider) 928beae007fc2f951e79ea307a5e983af4cb3acf Add test for P2SH-P2WSH in signrawtransactionwithkey and listunspent (MeshCollider) 314784a60f18424b004e935aa6e41b824e9645b3 Make listunspent and signrawtransaction RPCs support witnessScript (MeshCollider) Pull request description: This is a reworked version of #11708 after #12427 and the `signrawtransaction` split. For a P2WSH address, listunspent should return the witness script, and for a P2SH-P2WSH address, it should also return the inner witness script (because SignTransaction will automatically wrap it in P2SH if required). Includes a test which also tests the behaviour of #12427, and release note. Tree-SHA512: a8e72cf16930312bf48ec47e44a68f8d7e26664043c1b4cc0983eb25aec4087e511188ff9a0f181cd7b8a0c068c60d7f1e7e3f226b79e8c48890039dcf57f7b7
2019-02-14Remove hdmasterkeyidAndrew Chow
2019-02-14Add a method to CWallet to write just CKeyMetadataAndrew Chow
2019-02-14Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp}Andrew Chow
Creates new files util/bip32.h and util/bip32.cpp for containing BIP 32 stuff. Moves FormatKeyPath from descriptor.cpp to util/bip32. Adds a wrapper around it to prepent the 'm' for when just the BIP 32 style keypath is needed.
2019-02-14Refactor keymetadata writing to a separate methodAndrew Chow
2019-02-14Remove unused TransactionError constantsMarcoFalke
2019-02-14Merge #14978: Factor out PSBT utilities from RPCs for use in GUI code; ↵MeshCollider
related refactoring. 102faad81 Factor out combine / finalize / extract PSBT helpers (Glenn Willen) 78b9893d0 Remove op== on PSBTs; check compatibility in Merge (Glenn Willen) bd0dbe876 Switch away from exceptions in refactored tx code (Glenn Willen) c6c3d42a7 Move PSBT definitions and code to separate files (Glenn Willen) 81cd95884 Factor BroadcastTransaction out of sendrawtransaction (Glenn Willen) c734aaa15 Split DecodePSBT into Base64 and Raw versions (Glenn Willen) 162ffefd2 Add pf_invalid arg to std::string DecodeBase{32,64} (Glenn Willen) Pull request description: * Move most PSBT definitions into psbt.h. * Move most PSBT RPC utilities into psbt.{h,cpp}. * Move wallet-touching PSBT RPC utilities (FillPSBT) into wallet/psbtwallet.{h,cpp}. * Switch exceptions from JSONRPCError() to new PSBTException class. * Split DecodePSBT into DecodeBase64PSBT (old behavior) and DecodeRawPSBT. * Add one new version of DecodeBase64 utility in strencodings.h (and corresponding DecodeBase32 for completeness). * Factor BroadcastTransaction utility function out of sendrawtransaction RPC handler in rpc/rawtransaction.cpp Note: For those keeping score at home wondering why refactor, this is in anticipation of (and developed in parallel with) a change to actually introduce GUI use of all this stuff, which is already under development and working-ish. Tree-SHA512: 2197c448e657421f430943025357597e7b06c4c377d5d4b2622b9edea52a7193c48843dd731abb3a88ac4023a9c88d211991e0a9b740c22f2e1cbe72adefe390
2019-02-13Merge #15334: wallet: Log absolute paths for the walletsWladimir J. van der Laan
a4b92e467dd182621497deda1e80a9737629c75f Log full paths for wallets (Hennadii Stepanov) Pull request description: Fix #15333 `debug.log` with this PR: ``` ... 2019-02-03T19:02:35Z Using wallet directory /home/hebasto/.bitcoin/testnet3/wallets 2019-02-03T19:02:35Z init message: Verifying wallet(s)... 2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010) 2019-02-03T19:02:35Z Using wallet test_alpha/wallet.dat 2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/test_alpha/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/test_alpha/db.log 2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010) 2019-02-03T19:02:35Z Using wallet alpha_wallet/wallet.dat 2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/alpha_wallet/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/alpha_wallet/db.log 2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010) 2019-02-03T19:02:35Z Using wallet wallet.dat 2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/db.log 2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010) 2019-02-03T19:02:35Z Using wallet none/wallet.dat 2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/none/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/none/db.log 2019-02-03T19:02:35Z init message: Loading banlist... ... ``` Tree-SHA512: 8dd4408d3f6b04f396dd0ae0d248fedc3a0f6d36788556ae1662443f06f2ecce1c2be9456bf8d1b3d25b29c2a0cfb03cb805bde0a40387e68988ab932e17e118
2019-02-13Merge #15390: [wallet-tool] Close bdb when flushing walletMarcoFalke
318b1f7af1 [wallet] Close bdb when flushing wallet. (John Newbery) Pull request description: bdb would not be closed when closing the wallet in wallet-tool. Fix this by calling wallet->flush with true. Tree-SHA512: f722e527e4806eca5254221e944f57853d11bf89a9264309fa558a6cc2b23feefb7bb2963e87b4fad9cfb31ac4cffe563688988e0614a481a8ff1d393aceb132
2019-02-13Make listunspent and signrawtransaction RPCs support witnessScriptMeshCollider
2019-02-12Merge #14918: RPCHelpMan: Check default values are given at compile-timeMarcoFalke
fa0ad4e7ce RPCHelpMan: Check default values are given at compile-time (MarcoFalke) Pull request description: Remove the run time assertions on the default values and ensure that the correct default type and value is provided at compile time. Tree-SHA512: 80df2f3fab4379b500c773c27da63f22786c58be5963fe99744746320e43627a5d433eedf8b32209158df7805ebdce65ed4d242c829c4fe6e5d13deb4799ed42
2019-02-13Log full paths for walletsHennadii Stepanov
2019-02-12[wallet] Close bdb when flushing wallet.John Newbery
bdb would not be closed when closing the wallet in wallet-tool. Fix this by calling wallet->flush with true.
2019-02-12Merge #15153: gui: Add Open Wallet menuJonas Schnelli
1951ea434 gui: Show indeterminate progress dialog while opening walllet (João Barbosa) 8847cdaaa gui: Add OpenWalletActivity (João Barbosa) 4c8982a88 interfaces: Avoid interface instance if wallet is null (João Barbosa) be82dea23 gui: Add thread to run background activity in WalletController (João Barbosa) 6c49a55b4 gui: Add Open Wallet menu (João Barbosa) 32a8c6abf gui: Add openWallet and getWalletsAvailableToOpen to WalletController (João Barbosa) ab288b4e5 interfaces: Add loadWallet to Node (João Barbosa) 17abc0fd5 wallet: Factor out LoadWallet (João Barbosa) Pull request description: The *Open Wallet* menu has all the available wallets currently not loaded. The list of the available wallets comes from `listWalletDir`. In the future the menu can be replaced by a custom dialog. <img width="674" alt="screenshot 2019-01-12 at 12 17 02" src="https://user-images.githubusercontent.com/3534524/51073166-ac041480-1664-11e9-8302-be81702bc146.png"> Tree-SHA512: ebfd75eee0c8264863748899843afab67dadb7dff21313c11e3cb5b6108d954978dd1f1ae786bc07580c5a771ea4ab38d18c1643c9b9b3683ed53f0f6c582e38
2019-02-11Switch away from exceptions in refactored tx codeGlenn Willen
After refactoring general-purpose PSBT and transaction code out of RPC code, for use in the GUI, it's no longer appropriate to throw exceptions. Instead we now return bools for success, and take an output parameter for an error object. We still use JSONRPCError() for the error objects, since only RPC callers actually care about the error codes.
2019-02-11Move PSBT definitions and code to separate filesGlenn Willen
Move non-wallet PSBT code to src/psbt.{h,cpp}, and PSBT wallet code to src/wallet/psbtwallet.{h,cpp}. This commit contains only code movement (and adjustments to includes and Makefile.am.)
2019-02-11Split DecodePSBT into Base64 and Raw versionsGlenn Willen
Split up DecodePSBT, which both decodes base64 and then deserializes a PartiallySignedTransaction, into two functions: DecodeBase64PSBT, which retains the old behavior, and DecodeRawPSBT, which only performs the deserialization. Add a test for base64 decoding failure.
2019-02-11RPCHelpMan: Check default values are given at compile-timeMarcoFalke
2019-02-11Merge #15226: Allow creating blank (empty) wallets (alternative)MeshCollider
7687f7873 [wallet] Support creating a blank wallet (Andrew Chow) Pull request description: Alternative (kind of) to #14938 This PR adds a `blank` parameter to the `createwallet` RPC to create a wallet that has no private keys initially. `sethdseed` can then be used to make a clean wallet with a custom seed. `encryptwallet` can also be used to make a wallet that is born encrypted. Instead of changing the version number as done in #14938, a wallet flag is used to indicate that the wallet should be blank. This flag is set at creation, and then unset when the wallet is no longer blank. A wallet becomes non-blank when a HD seed is set or anything is imported. The main change to create a blank wallet is primarily taken from #14938. Also with this, the term "blank wallet" is used instead of "empty wallet" to avoid confusion with wallets that have balance which would also be referred to as "empty". This is built on top of #15225 in order to fix GUI issues. Tree-SHA512: 824d685e11ac2259a26b5ece99c67a7bda94a570cd921472c464243ee356b7734595ad35cc439b34357135df041ed9cba951e6edac194935c3a55a1dc4fcbdea
2019-02-10[wallet] Support creating a blank walletAndrew Chow
A blank wallet is a wallet that has no keys, script or watch only things. A new wallet flag indicating that it is blank will be set when the wallet is blank. Once it is no longer blank (a seed has been generated, keys or scripts imported, etc), the flag will be unset.