aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.h
Commit message (Collapse)AuthorAgeFilesLines
* Move various SigningProviders to signingprovider.{cpp,h}Andrew Chow2019-07-091-57/+0
| | | | | | | | | Moves all of the various SigningProviders out of sign.{cpp,h} and keystore.{cpp,h}. As such, keystore.{cpp,h} is also removed. Includes and the Makefile are updated to reflect this. Includes were largely changed using: git grep -l "keystore.h" | xargs sed -i -e 's;keystore.h;script/signingprovider.h;g'
* scripted-diff: rename CBasicKeyStore to FillableSigningProviderAndrew Chow2019-07-091-2/+2
| | | | | | -BEGIN VERIFY SCRIPT- git grep -l "CBasicKeyStore" | xargs sed -i -e 's/CBasicKeyStore/FillableSigningProvider/g' -END VERIFY SCRIPT-
* Move HaveKey static function from keystore to rpcwallet where it is usedAndrew Chow2019-07-091-3/+0
|
* Remove CKeyStore and squash into CBasicKeyStoreAndrew Chow2019-07-091-40/+19
|
* Add HaveKey and HaveCScript to SigningProviderAndrew Chow2019-07-031-2/+0
|
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Refactors `keystore.h` type aliases.2512018-07-121-8/+5
| | | | | | This squashed commit either encapsulates type alias declarations at the appropriate scope; or removes type aliases that are not used. The encapsulated type aliases are declared using C++11's `using` notation in favor of the `typedef` notation.
* Merge #13114: wallet/keystore: Add Clang thread safety annotations for ↵MarcoFalke2018-07-111-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | variables guarded by cs_KeyStore 968b76f77c Add missing cs_KeyStore lock (practicalswift) 4bcd5bb87d Add locking annotations for variables guarded by cs_KeyStore (practicalswift) Pull request description: * Add Clang thread safety annotations for variables guarded by `cs_KeyStore` * Add missing `cs_KeyStore` lock Tree-SHA512: 7d93513c2da0cd564b9f1e75aa5156a454a4133eb845020fde8872e685dd5758353e93c33364aeea4a812c08353a810494e503a5ce160cc5be0af5af4bb2e6d7
| * Add locking annotations for variables guarded by cs_KeyStorepracticalswift2018-04-291-4/+4
| |
* | Separate HaveKey function that checks whether a key is in a keystoreAndrew Chow2018-05-051-0/+3
|/
* Add compile time checking for all cs_KeyStore runtime locking assertionspracticalswift2018-04-251-1/+1
|
* Merge #12762: Make CKeyStore an interfaceWladimir J. van der Laan2018-03-271-4/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | f381299 Move CKeyStore::cs_KeyStore to CBasicKeyStore (João Barbosa) 25eb9f5 Inline CKeyStore::AddKey(const CKey &) in CBasicKeyStore (João Barbosa) Pull request description: Made these simplifications while reviewing #12714. This aims to make `CKeyStore` a *pure* interface: - no variable members - the mutex is moved to `CBasicKeyStore` which is where it is used; - no method implementations - `AddKey(const CKey &)` is moved to `CBasicKeyStore` which is where it is needed. Tree-SHA512: 84e44f4390c59600e5cefa599b5464e1771c31dd4abc678ef50db8e06ffac778d692860a352918444f8bcd66430634637b6277a818a658721ffc4f381c1c6a90
| * Move CKeyStore::cs_KeyStore to CBasicKeyStoreJoão Barbosa2018-03-241-3/+2
| |
| * Inline CKeyStore::AddKey(const CKey &) in CBasicKeyStoreJoão Barbosa2018-03-241-1/+1
| |
* | Introduce interface for signing providersPieter Wuille2018-03-251-6/+2
|/ | | | | | | | | | | | | | | | CKeyStore is a rich interface that provides many features, including knowledge of scripts and pubkeys for solving, private keys for signing, in addition to watch-only keys and scripts, and distinguishing lack of keys from them just being encrypted. The signing logic in script/sign does not actually need most of these features. Here we introduce a simpler interface (SigningProvider) which *only* provides keys and scripts. This is actually sufficient for signing. In addtion, we swap the dependency between keystore and script/sign (keystore now depends on script/script with CKeyStore deriving from SigningProvider, rather than CKeyStore being the interface that signing relies on).
* Merge #11403: SegWit wallet supportJonas Schnelli2018-01-101-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b224a47a1 Add address_types test (Pieter Wuille) 7ee54fd7c Support downgrading after recovered keypool witness keys (Pieter Wuille) 940a21932 SegWit wallet support (Pieter Wuille) f37c64e47 Implicitly know about P2WPKH redeemscripts (Pieter Wuille) 57273f2b3 [test] Serialize CTransaction with witness by default (Pieter Wuille) cf2c0b6f5 Support P2WPKH and P2SH-P2WPKH in dumpprivkey (Pieter Wuille) 37c03d3e0 Support P2WPKH addresses in create/addmultisig (Pieter Wuille) 3eaa003c8 Extend validateaddress information for P2SH-embedded witness (Pieter Wuille) 30a27dc5b Expose method to find key for a single-key destination (Pieter Wuille) 985c79552 Improve witness destination types and use them more (Pieter Wuille) cbe197470 [refactor] GetAccount{PubKey,Address} -> GetAccountDestination (Pieter Wuille) 0c8ea6380 Abstract out IsSolvable from Witnessifier (Pieter Wuille) Pull request description: This implements a minimum viable implementation of SegWit wallet support, based on top of #11389, and includes part of the functionality from #11089. Two new configuration options are added: * `-addresstype`, with options `legacy`, `p2sh`, and `bech32`. It controls what kind of addresses are produced by `getnewaddress`, `getaccountaddress`, and `createmultisigaddress`. * `-changetype`, with the same options, and by default equal to `-addresstype`, that controls what kind of change is used. All wallet private and public keys can be used for any type of address. Support for address types dependent on different derivation paths will need a major overhaul of how our internal detection of outputs work. I expect that that will happen for a next major version. The above also applies to imported keys, as having a distinction there but not for normal operations is a disaster for testing, and probably for comprehension of users. This has some ugly effects, like needing to associate the provided label to `importprivkey` with each style address for the corresponding key. To deal with witness outputs requiring a corresponding redeemscript in wallet, three approaches are used: * All SegWit addresses created through `getnewaddress` or multisig RPCs explicitly get their redeemscripts added to the wallet file. This means that downgrading after creating a witness address will work, as long as the wallet file is up to date. * All SegWit keys in the wallet get an _implicit_ redeemscript added, without it being written to the file. This means recovery of an old backup will work, as long as you use new software. * All keypool keys that are seen used in transactions explicitly get their redeemscripts added to the wallet files. This means that downgrading after recovering from a backup that includes a witness address will work. These approaches correspond to solutions 3a, 1a, and 5a respectively from https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2. As argued there, there is no full solution for dealing with the case where you both downgrade and restore a backup, so that's also not implemented. `dumpwallet`, `importwallet`, `importmulti`, `signmessage` and `verifymessage` don't work with SegWit addresses yet. They're remaining TODOs, for this PR or a follow-up. Because of that, several tests unexpectedly run with `-addresstype=legacy` for now. Tree-SHA512: d425dbe517c0422061ab8dacdc3a6ae47da071450932ed992c79559d922dff7b2574a31a8c94feccd3761c1dffb6422c50055e6dca8e3cf94a169bc95e39e959
| * Implicitly know about P2WPKH redeemscriptsPieter Wuille2018-01-091-0/+2
| | | | | | | | | | Make CKeyStore automatically known about the redeemscripts necessary for P2SH-P2WPKH (and due to the extra checks in IsMine, also P2WPKH) spending.
| * Expose method to find key for a single-key destinationPieter Wuille2018-01-031-0/+3
| |
* | Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
| |
* | Add GetCScripts to CBasicKeyStoreMeshCollider2017-12-201-0/+2
|/
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* CKeystore: move relevant implementation out of the headerJonas Schnelli2017-10-041-31/+3
|
* Merge #10916: add missing lock to crypter GetKeys()Wladimir J. van der Laan2017-09-071-11/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | fe09b0197 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da04b keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: #10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
| * keystore GetKeys(): return result instead of writing to referenceMarko Bencun2017-07-231-11/+7
| | | | | | | | | | | | | | | | Issue: #10905 By returning the result, a few useless lines can be removed. Return-value-optimization means there should be no copy.
* | Remove the virtual specifier for functions with the override specifierpracticalswift2017-08-091-7/+7
|/ | | | | | `override` guarantees that the function is virtual (in addition to that the function is overriding a virtual function from a base class).
* Use the override specifier (C++11) where we expect to be overriding the ↵practicalswift2017-06-281-12/+12
| | | | virtual function of a base class
* Remove unused Boost includespracticalswift2017-06-091-1/+0
|
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* Add logic to track pubkeys as watch-only, not just scriptsMatt Corallo2015-07-201-1/+4
|
* c++11: don't forward-declare types used in mapsCory Fields2015-02-031-3/+2
|
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* boost: moveonly: split CPubKey and friends to new filesCory Fields2014-10-311-0/+1
|
* Update comments in keystore to be doxygen compatibleMichael Ford2014-10-281-6/+6
|
* script: move CScriptID to standard.h and add a ctor for creating them from ↵Cory Fields2014-10-171-0/+1
| | | | | | | | | | | | | | | | CScripts This allows for a reversal of the current behavior. This: CScript foo; CScriptID bar(foo.GetID()); Becomes: CScript foo; CScriptID bar(foo); This way, CScript is no longer dependent on CScriptID or Hash();
* [Wallet] Watch-only fixesCozz Lovan2014-10-031-0/+2
|
* add missing header end commentsPhilip Kaufmann2014-08-281-1/+1
| | | | | | - ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
* Merge pull request #4673Wladimir J. van der Laan2014-08-261-0/+2
|\ | | | | | | | | 1c5f0af [Qt] Add column Watch-only to transactions list (Cozz Lovan) 939ed97 Add boolean HaveWatchonly and signal NotifyWatchonlyChanged (Cozz Lovan)
| * Add boolean HaveWatchonly and signal NotifyWatchonlyChangedCozz Lovan2014-08-111-0/+2
| |
* | Remove unnecessary typedef and script.h includejtimon2014-08-121-9/+0
|/
* Use script matching rather than destination matching for watch-only.Pieter Wuille2014-07-021-5/+5
| | | | | | | | | | | | | | | | | | | This changes the keystore data format, wallet format and IsMine logic to detect watch-only outputs based on direct script matching rather than first trying to convert outputs to destinations (addresses). The reason is that we don't know how the software that has the spending keys works. It may support the same types of scripts as us, but that is not guaranteed. Furthermore, it removes the ambiguity between addresses used as identifiers for output scripts or identifiers for public keys. One practical implication is that adding a normal pay-to-pubkey-hash address via importaddress will not cause payments to the corresponding full public key to be detected as IsMine. If that is wanted, add those scripts directly (importaddress now also accepts any hex-encoded script). Conflicts: src/wallet.cpp
* Add support for watch-only addressesPieter Wuille2014-07-021-0/+19
| | | | | | | | | | | | | | | | | | | | | | Changes: * Add Add/Have WatchOnly methods to CKeyStore, and implementations in CBasicKeyStore. * Add similar methods to CWallet, and support entries for it in CWalletDB. * Make IsMine in script/wallet return a new enum 'isminetype', rather than a boolean. This allows distinguishing between spendable and unspendable coins. * Add a field fSpendable to COutput (GetAvailableCoins' return type). * Mark watchonly coins in listunspent as 'watchonly': true. * Add 'watchonly' to validateaddress, suppressing script/pubkey/... in this case. Based on a patch by Eric Lombrozo. Conflicts: src/qt/walletmodel.cpp src/rpcserver.cpp src/wallet.cpp
* Update moved and dead linksLuke Dashjr2014-03-241-1/+1
|
* Move CCryptoKeyStore to crypter.cppWladimir J. van der Laan2013-12-041-83/+0
| | | | This breaks the dependency on crypter for disable-wallet builds.
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-1/+5
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Bump Year Number to 2013super32013-10-201-1/+1
|
* CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille2013-05-301-15/+6
|
* Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-20/+19
| | | | | | | | | | | | | | | | | This introduces internal types: * CKeyID: reference (hash160) of a key * CScriptID: reference (hash160) of a script * CTxDestination: a boost::variant of the former two CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code. Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers.
* Encapsulate public keys in CPubKeyPieter Wuille2012-05-241-4/+4
|
* Merge pull request #1354 from fanquake/masterPieter Wuille2012-05-201-1/+1
|\ | | | | Update Header Licenses
| * Update License in File HeadersFordy2012-05-181-1/+1
| | | | | | | | | | | | I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.