aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
AgeCommit message (Collapse)Author
2019-02-28Support ranges arguments in RPC helpPieter Wuille
2019-02-28Add ParseRange function to parse args of the form int/[int,int]Pieter Wuille
2019-02-25Merge #15401: rpc: Actually throw help when passed invalid number of paramsWladimir J. van der Laan
fa4ce7038d444defe0b98a30097174c278054a33 rpc: Actually throw help when passed invalid number of params (MarcoFalke) fa05626ca7a0fe896ac554c79eaea4c36acdf861 rpc: Add RPCHelpMan::IsValidNumArgs() (MarcoFalke) Pull request description: Can be tested by * running the included test against an old binary (compiled without this patch) * calling `setban 1 "add" 3 4 5 6 7 8 9 0` in the gui Tree-SHA512: aa6a25bbe6f40722913ea292252a62a4012c964eed9f4035335a2e2d13be98eb60f368e8a3251a104a26a62c08b2cb926b06e5ab1418ef1cf4abdd71d87c2919
2019-02-20rpc: Add RPCHelpMan::IsValidNumArgs()MarcoFalke
2019-02-18Add missing #include.Daniel Kraft
bd0dbe8763fc3029cf96531c9ccaba280b939445 introduced a dependency of rpc/util.h on RPCErrorCode, defined in rpc/protocol.h. The latter file is only included from rpc/util.cpp, though. This commit fixes the missing include, by moving the #include of rpc/protocol.h to rpc/util.h.
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-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-11Factor out combine / finalize / extract PSBT helpersGlenn Willen
Refactor the new CombinePSBT, FinalizePSBT, and FinalizeAndExtractPSBT general-purpose functions out of the combinepsbt and finalizepsbt RPCs, for use in the GUI code.
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-11RPCHelpMan: Check default values are given at compile-timeMarcoFalke
2019-02-08Move ParseConfirmTarget from rpc/mining to rpc/utilRussell Yanofsky
Util is a better home since it's called both by wallet and mining code. Suggested https://github.com/bitcoin/bitcoin/pull/15288#discussion_r254449444
2019-01-25RPCHelpMan: Pass through Result and ExamplesMarcoFalke
2018-12-10RPCHelpMan: Support required arguments after optional onesMarcoFalke
2018-12-07rpc: Assert named arguments are unique in RPCHelpManJoão Barbosa
2018-12-04RPCHelpMan: Add space after colons in extended descriptionMarcoFalke
Also, add doxygen comment to ToDescriptionString
2018-11-27rpc: Pass argument descriptions to RPCHelpManMarcoFalke
2018-11-14Use RPCHelpMan for all RPCsMarcoFalke
2018-11-12rpc: Add RPCHelpMan for machine-generated helpMarcoFalke
2018-11-06Pass chain and client variables where neededRussell Yanofsky
This commit does not change behavior. All it does is pass new function parameters. It is easiest to review this change with: git log -p -n1 -U0 --word-diff-regex=.
2018-11-04scripted-diff: Move util files to separate directory.Jim Posen
-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-
2018-07-27Update copyright headers to 2018DrahtBot
2018-03-16Merge #12542: Remove redundant includes. Conform to header include guidelines.Pieter Wuille
7ef46d063a Remove redundant includes. Conform to header include guidelines. (practicalswift) Pull request description: From the header include guidelines ([developer-notes.md](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization)): > "One exception is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file." Covered in this PR: * `rpc/util.h` includes `pubkey.h` + `utilstrencodings.h`. `rpc/util.cpp` includes `rpc/util.h`. * `util.h` includes `fs.h`. `util.cpp` includes `util.h`. Tree-SHA512: a38d9ecefd8165ad151c1ffde52cfbac968526c49db2080988bf6e6a3daa2ebeceb34d08f817e275edf7c650bf3155de01369bfb352522f8e0ae136b2289b194
2018-02-27Remove redundant includes. Conform to header include guidelines.practicalswift
From the header include guidelines (developer-notes.md): "One exception is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file." * rpc/util.h includes pubkey.h + utilstrencodings.h. rpc/util.cpp includes rpc/util.h. * util.h includes fs.h. util.cpp includes util.h.
2018-02-19Split key_io (address/key encodings) off from base58Pieter Wuille
2018-02-16[rpc] Move DescribeAddressVisitor to rpc/utilJohn Newbery
2018-01-11Disallow using addresses in createmultisigAndrew Chow
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.