aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make and get the multisig redeemscript and destination in one function ↵Andrew Chow2019-06-211-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* [rpc] Remove deprecated functionality message from validateaddress helpJohn Newbery2019-03-221-5/+1
| | | | This functionality was removed in v0.18.
* [rpc] deriveaddresses: add range to CRPCConvertParamSjors Provoost2019-03-011-1/+1
|
* Make deriveaddresses use stop/[start,stop] notation for rangesPieter Wuille2019-02-281-16/+16
|
* Make descriptor checksums mandatory in deriveaddresses and importmultiPieter Wuille2019-02-151-2/+2
|
* Add getdescriptorinfo to compute checksumPieter Wuille2019-02-151-0/+41
|
* RPCHelpMan: Check default values are given at compile-timeMarcoFalke2019-02-111-19/+19
|
* Merge #14667: Add deriveaddresses RPC util methodMeshCollider2019-02-081-0/+91
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 595283851 [rpc] util: add deriveaddresses method (Sjors Provoost) Pull request description: Usage: ```sh bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/0)" [ "bc1qg6ucjz7kgdedam7v5yarecy54uqw82yym06z3q" ] // part of the BIP32 test vector ``` Avoids the need for external (BIP32) libraries to derive an address. Can be used in conjunction with `scantxoutset` as a poor mans wallet. Might be useful to test more complicated future descriptors. ~To keep it as simple as possible it only supports descriptors that result in a single address, so no `combo()` and ranges.~ As discussed recently on IRC it might make sense to put this in a separate utility along with other descriptor and psbt utility functions which don't need a chain or wallet context. However I prefer to leave that to another PR. Tree-SHA512: b8e53db11a8fd87638cc98766270cc3be9adc4b3e5085798a6a4e2e6ad252bf6d2189346bbb2da72d04d13f7f1e80b5cb88e8039653bea1f150602a876ef7f34
| * [rpc] util: add deriveaddresses methodSjors Provoost2019-01-291-0/+91
| |
* | Merge #15266: memory: Construct globals on first useMarcoFalke2019-02-041-6/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 77777c5624 log: Construct global logger on first use (MarcoFalke) Pull request description: The (de)initialization order is not well defined in C++, so generally it is not safe to use globals as the (de/con)structor of one global could use the (de/con)structor of another global before/after it has been (con/de)structed. Specifically this fixes: * `g_logger` might not be initialized on the first use, so do that. (Fixes #15111) Tree-SHA512: eb9c22f4baf31ebc5b0b9ee6a51d1354bae1f0df186cc0ce818b4483c7b5a7f90268d2b549ee96b4c57f8ef36ab239dc6497f74f3e2ef166038f7437c368297d
| * | log: Construct global logger on first useMarcoFalke2019-01-291-6/+6
| | |
* | | doc: correct logging rpc return type and examplefanquake2019-01-291-2/+2
| |/ |/|
* | RPCHelpMan: Pass through Result and ExamplesMarcoFalke2019-01-251-40/+52
|/
* rpc: Document default values for optional argumentsMarcoFalke2018-12-071-4/+4
|
* rpc: Pass argument descriptions to RPCHelpManMarcoFalke2018-11-271-50/+33
|
* rpc: Documentation fixupsMarcoFalke2018-11-151-1/+1
|
* Use RPCHelpMan for all RPCsMarcoFalke2018-11-141-20/+51
|
* scripted-diff: Move util files to separate directory.Jim Posen2018-11-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- mkdir -p src/util git mv src/util.h src/util/system.h git mv src/util.cpp src/util/system.cpp git mv src/utilmemory.h src/util/memory.h git mv src/utilmoneystr.h src/util/moneystr.h git mv src/utilmoneystr.cpp src/util/moneystr.cpp git mv src/utilstrencodings.h src/util/strencodings.h git mv src/utilstrencodings.cpp src/util/strencodings.cpp git mv src/utiltime.h src/util/time.h git mv src/utiltime.cpp src/util/time.cpp sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj -END VERIFY SCRIPT-
* Bugfix: RPC: Add address_type named param for createmultisigLuke Dashjr2018-10-281-1/+1
|
* [rpc] Descriptions: Textual consistency fixesJon Layton2018-10-091-4/+4
| | | | | | | | | | | | | | 'Must be one of' should always end in a ':' 'hex encoded' is now always 'hex-encoded' Remove redundant '(defaults to CONSERVATIVE)' text from estimatesmartfee Consistent spacing for options '( verbose )' and '( verbosity )' 'BIP125 replaceable' is now always 'BIP125-replaceable' JSON-RPC example is now always 'As a JSON-RPC call'
* Merge #14008: Preserve a format of RPC command definitionsWladimir J. van der Laan2018-09-101-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | d9d79576f423cd9c5cef4547c7e3648dbb339460 Preserve a format of RPC command definitions (Kostiantyn Stepaniuk) Pull request description: Currently, RPC commands are formatted in a way that it's easy to read and that `test/lint/check-rpc-mappings.py` can parse it. To void breaking `test/lint/check-rpc-mappings.py` script by running `clang-format`, RPC command definitions should be disabled for clang-format. Tree-SHA512: e17d20ec0e6c4e19410198b55687ebbe6fa01654d214d4578cd16c00b872bf8b0b306594a45523685cd2e9d9280702e00471d9366e87954428e8bbeacd8cad60
| * Preserve a format of RPC command definitionsKostiantyn Stepaniuk2018-08-201-0/+2
| | | | | | | | | | | | | | | | Currently RPC commands are formatted in a way that it's easy to read and that test/lint/check-rpc-mappings.py can parse it. To void breaking test/lint/check-rpc-mappings.py script by running clang-format, RPC command definitions should be disabled for clang-format.
* | [RPC] Remove warning about wallet addresses in createmultisig()John Newbery2018-08-271-2/+1
| | | | | | | | | | createmultisig() was updated in V0.16 to not use the wallet. Warning text was included to warn the user. Remove that now.
* | [rpc] Remove deprecated validateaddress usage.John Newbery2018-08-271-23/+7
|/
* Merge #13891: [RPC] Remove getinfo deprecation warningWladimir J. van der Laan2018-08-151-13/+0
|\ | | | | | | | | | | | | | | | | | | b2f23c41538eaadd71c373ada75dd3a982eeb8bf [RPC] Remove getinfo deprecation warning (John Newbery) Pull request description: `getinfo` was removed in V0.16. A removal warning message was left in place to tell users that the method had been removed. We can remove that entirely in V0.18. Tree-SHA512: bf93fbcf57a9be480438dcbdcab2dfd69ce277218b10628776975b093b3ffd2caa1751e0fb4cb0245443c81465693e2b8750e96d3e38632a78bae5ffa04f9212
| * [RPC] Remove getinfo deprecation warningJohn Newbery2018-08-061-13/+0
| |
* | Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|/
* segwit support for createmultisig RPCAnthony Towns2018-07-101-5/+16
|
* Merge #13235: Break circular dependency: init -> * -> init by extracting ↵Wladimir J. van der Laan2018-07-041-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | shutdown.h 1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley) e62fdfeea Drop unused init.h includes (Ben Woosley) Pull request description: Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`. Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
| * Drop unused init.h includesBen Woosley2018-06-251-1/+0
| | | | | | | | | | | | These were entirely unused, as based on successful compilation and a grep for: \bStartShutdown\(\)|\bShutdownRequested\(\)|\bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h
* | Delete double semicolon in wallet.cpp and misc.cppMatteo Sumberaz2018-07-021-1/+1
|/
* Make it clear which functions that are intended to be translation unit localpracticalswift2018-05-031-8/+8
| | | | | Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
* util: Refactor GetLogCategory.Jim Posen2018-04-291-9/+8
| | | | | Changing parameter types from pointers to references and uint32_t to BCLog::LogFlags simplies calling code.
* util: Encapsulate logCategories within BCLog::Logger.Jim Posen2018-04-271-14/+16
|
* wallet: Add HasWalletsJoão Barbosa2018-04-181-1/+1
|
* wallet: Add AddWallet, RemoveWallet, GetWallet and GetWalletsJoão Barbosa2018-04-181-1/+1
| | | | | With these new functions all vpwallets usage are removed and vpwallets is now a static variable (no external linkage).
* Merge #11372: Address encoding cleanupWladimir J. van der Laan2018-03-071-7/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 92f1f8b31 Split off key_io_tests from base58_tests (Pieter Wuille) 119b0f85e Split key_io (address/key encodings) off from base58 (Pieter Wuille) ebfe217b1 Stop using CBase58Data for ext keys (Pieter Wuille) 32e69fa0d Replace CBitcoinSecret with {Encode,Decode}Secret (Pieter Wuille) Pull request description: This PR contains some of the changes left as TODO in #11167 (and built on top of that PR). They are not intended for backporting. This removes the `CBase58`, `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey` classes, in favor of simple `Encode`/`Decode` functions. Furthermore, all Bitcoin-specific logic (addresses, WIF, BIP32) is moved to `key_io.{h,cpp}`, leaving `base58.{h,cpp}` as a pure utility that implements the base58 encoding/decoding logic. Tree-SHA512: a5962c0ed27ad53cbe00f22af432cf11aa530e3efc9798e25c004bc9ed1b5673db5df3956e398ee2c085e3a136ac8da69fe7a7d97a05fb2eb3be0b60d0479655
| * Split key_io (address/key encodings) off from base58Pieter Wuille2018-02-191-1/+1
| |
| * Replace CBitcoinSecret with {Encode,Decode}SecretPieter Wuille2018-02-191-6/+3
| |
* | Merge #12503: [RPC] createmultisig no longer takes addressesMarcoFalke2018-02-211-1/+1
|\ \ | |/ |/| | | | | | | | | | | e4c924c517 createmultisig no longer takes addresses (Gregory Sanders) Pull request description: Tree-SHA512: a6a752ef2282c5c893dd1a6ff5ccab42d3de1989847af627d82d41605ea19abc0aaf68567a62b6478933ba7eea09f911087b410ba7d3a815331ef15ec1ff9df0
| * createmultisig no longer takes addressesGregory Sanders2018-02-211-1/+1
| |
* | Create getaddressinfo RPC and deprecate parts of validateaddressAndrew Chow2018-02-161-181/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Moves the parts of validateaddress which require the wallet into getaddressinfo which is part of the wallet RPCs. Mark those parts of validateaddress which require the wallet as deprecated. Validateaddress will call getaddressinfo for the data that both share for right now. Moves IsMine functions to libbitcoin_common and then links libbitcoin_wallet before libbitcoin_common in order to prevent linker errors since IsMine is no longer used in libbitcoin_server.
* | [rpc] Move DescribeAddressVisitor to rpc/utilJohn Newbery2018-02-161-54/+12
| |
* | [rpc] split wallet and non-wallet parts of DescribeAddressVisitorJohn Newbery2018-02-151-26/+63
| |
* | scripted-diff: Use UniValue.pushKV instead of push_back(Pair())Karel Bilek2018-02-101-36/+36
|/ | | | | | -BEGIN VERIFY SCRIPT- git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g" -END VERIFY SCRIPT-
* [RPC] Remove deprecated createmultisig objectJohn Newbery2018-02-081-11/+1
|
* Merge #11415: [RPC] Disallow using addresses in createmultisigWladimir J. van der Laan2018-01-241-77/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1df206f Disallow using addresses in createmultisig (Andrew Chow) Pull request description: This PR should be the last part of #7965. This PR makes createmultisig only accept public keys and marks the old functionality of accepting addresses as deprecated. It also splits `_createmultisig_redeemscript` into two functions, `_createmultisig_getpubkeys` and `_createmultisig_getaddr_pubkeys`. `_createmultisig_getpubkeys` retrieves public keys from the RPC parameters and `_createmultisig_getaddr_pubkeys` retrieves addresses' public keys from the wallet. `_createmultisig_getaddr_pubkeys` requires the wallet and is only used by `addwitnessaddress` (except when `createmultisig` is used in deprecated mode). `addwitnessaddress`'s API is also changed. Instead of returning just an address, it now returns the same thing as `createmultisig`: a JSON object with two fields, address and redeemscript. Tree-SHA512: a5796e41935ad5e47d8165ff996a8b20d5112b5fc1a06a6d3c7f5513c13e7628a4fd37ec30fde05d8b15abfed51bc250710140f6834b13f64d0a0e47a3817969
| * Disallow using addresses in createmultisigAndrew Chow2018-01-111-77/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make createmultisig only accept public keys with the old functionality marked as deprecated. Splits _createmultisig_redeemscript into two functions, one for getting public keys from UniValue and one for getting addresses from UniValue and then their respective public keys. The one for retrieving address's public keys is located in rpcwallet.cpp Changes addwitnessaddress's output to be a JSON object with two fields, address and redeemscript. Adds a test to deprecated_rpc.py for testing the deprecation. Update the tests to use addwitnessaddress or give only public keys to createmultisig. Anything that used addwitnessaddress was also updated to reflect the new API.
* | rpc: Add deprecation error for `getinfo`Wladimir J. van der Laan2018-01-171-0/+13
|/ | | | | Add a short informative deprecation message when users use `getinfo`, that points them to the new calls where to get the different information fields.
* Merge #11403: SegWit wallet supportJonas Schnelli2018-01-101-27/+65
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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