Commit Graph

66 Commits

Author SHA1 Message Date
MarcoFalke aaaaad6ac9
scripted-diff: Bump copyright of files changed in 2019
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2019-12-30 10:42:20 +13:00
Jeremy Rubin 7414d3820c Add RPC Whitelist Feature from #12248 2019-12-11 12:33:54 -08:00
Wladimir J. van der Laan f3b51eb935 Fix occurences of c_str() used with size() to data()
Using `data()` better communicates the intent here.

Also, depending on how `c_str()` is implemented, this fixes undefined
behavior: The part of the string after the first NULL character might
have undefined contents.
2019-10-28 13:41:45 +01:00
practicalswift 084e17cebd Remove unused includes 2019-10-15 22:56:43 +00:00
Hennadii Stepanov 753f7cccce
scripted-diff: Make translation bilingual
-BEGIN VERIFY SCRIPT-
sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h
sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h
sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src)
echo Hard cases - multiline strings.
sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp
sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp
sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp
sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp
echo Special case.
sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py
-END VERIFY SCRIPT-
2019-07-24 16:33:20 +03:00
Hennadii Stepanov 0b86e517ad
Refactor out translation.h
This is a prerequisite for introducing bilingual error messages.
Note: #includes are arranged by clang-format-diff.py script.
2019-07-24 16:32:53 +03:00
practicalswift eca9767673 Make reasoning about dependencies easier by not including unused dependencies 2019-06-02 17:15:23 +02:00
Jim Posen 2068f089c8 scripted-diff: Move util files to separate directory.
-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-11-04 22:46:07 -08:00
Arvid Norberg 3ccfa34b32 convert C-style (void) parameter lists to C++ style () 2018-09-13 10:36:41 -07:00
John Newbery 7d038dcb41 [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
MarcoFalke f87d0a9d75
Merge #13534: Don't assert(foo()) where foo() has side effects
6ad0328f1c Don't assert(foo()) where foo has side effects (practicalswift)

Pull request description:

  Don't `assert(foo())` where `foo` has side effects.

  From `assert(3)`:

  > If the macro `NDEBUG` is defined at the moment `<assert.h>` was last included, the macro `assert()` generates no code, and hence does nothing at all.

  Bitcoin currently cannot be compiled without assertions, but we shouldn't rely on that.

Tree-SHA512: 28cff0c6d1c2fb612ca58c9c94142ed01c5cfd0a2fecb8e59cdb6c270374b215d952ed3491d921d84dc1b439fa49da4f0e75e080f6adcbc6b0e08be14e54c170
2018-08-13 10:02:50 -04:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
João Barbosa 12dd101345 scripted-diff: Remove trailing whitespaces
-BEGIN VERIFY SCRIPT-

sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test  ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')

-END VERIFY SCRIPT-
2018-07-24 20:46:23 +01:00
Mason Simon c64cc1bd94 scripted-diff: Fix references to share/rpcuser (now share/rpcauth)
Commit 3fdb29778a renamed share/rpcuser to share/rpcauth but left references to the old path in code; this commit fixes the old references.

Performed update using https://github.com/facebook/codemod with command: `codemod --extensions cpp,py,md 'share/rpcuser' 'share/rpcauth'`

-BEGIN VERIFY SCRIPT-
git grep --files-with-matches 'share/rpcuser' src/*.cpp | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
git grep --files-with-matches 'share/rpcuser' test/functional/*.py | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
-END VERIFY SCRIPT-
2018-07-15 17:56:02 -07:00
practicalswift 6ad0328f1c Don't assert(foo()) where foo has side effects 2018-07-07 10:08:49 +02:00
Linrono dae0d13bbb RPCAuth Detection in Logs
This adds a log entry for when RPCAuth is used.

Update httprpc.cpp
2018-05-16 23:37:13 -04:00
Wladimir J. van der Laan bd59c4395c
Merge #12859: Bugfix: Include <memory> for std::unique_ptr
a5bca13 Bugfix: Include <memory> for std::unique_ptr (Luke Dashjr)

Pull request description:

  Not sure why all these includes were missing, but it's breaking builds for some users:

  https://bugs.gentoo.org/show_bug.cgi?id=652142

  (Added to all files with a reference to `std::unique_ptr`)

Tree-SHA512: 8a2c67513ca07b9bb52c34e8a20b15e56f8af2530310d9ee9b0a69694dd05e02e7a3683f14101a2685d457672b56addec591a0bb83900a0eb8e2a43d43200509
2018-04-05 09:31:53 +02:00
Luke Dashjr a5bca13095 Bugfix: Include <memory> for std::unique_ptr 2018-04-02 18:31:52 +00:00
Wladimir J. van der Laan b648974cc3
Merge #12778: RPC: Add username and ip logging for RPC method requests
4d74c78 Add username and ip logging for RPC method requests (Gabriel Davidian)

Pull request description:

  Adds username and IP logging (if enabled via -logips command) to RPC method request logging.
  This closes #12223

Tree-SHA512: a441228e80ea6884ec379c66e949d86df3689770f1b3c3608015cf5a36d2dfb38051298a7f6ea6dfdfbf0b3b6c896e414c8dc54e9833bb73dd65bdb1832f4395
2018-03-27 20:53:06 +02:00
Jonas Schnelli 25cf18f239
Merge #12610: Multiwallet for the GUI
779c5f984 Qt: hide RPCConsole wallet selector when no wallets are present (Jonas Schnelli)
dc6f150f3 Qt: show wallet name in request dlg in case of multiwallet (Jonas Schnelli)
4826ca4b8 Qt: show wallet name in send confirmation dlg in case of multiwallet (Jonas Schnelli)
cfa4133ce GUI: RPCConsole: Log wallet changes (Luke Dashjr)
b6d04fc7c Qt: Get wallet name from WalletModel rather than passing it around (Luke Dashjr)
12d8d2681 Qt: When multiple wallets are used, include in notifications the name (Jonas Schnelli)
d1ec34a76 Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed (Luke Dashjr)
d49cc70e6 Qt: Add wallet selector to debug console (Jonas Schnelli)
d558f44c5 Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ (Luke Dashjr)
85d531971 Qt: Ensure UI updates only come from the currently selected walletView (Luke Dashjr)
e449f9a9e Qt: Add a combobox to toolbar to select from multiple wallets (Luke Dashjr)
3dba3c3ac Qt: Load all wallets into WalletModels (Luke Dashjr)

Pull request description:

  This is an overhaul of #11383 (plus some additions).
  It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of `CWallet` (plus other minor design changes).

  Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Tree-SHA512: 3d06e18badbc5d1821e488bf1dae463bb0be544cf11b2b618e025812bfdd13c5f39604bb93b4c705313930e7dc4e66f4848b9469ba14871bade58e7a027246a1
2018-03-26 18:51:38 +07:00
Gabriel Davidian 4d74c78c69 Add username and ip logging for RPC method requests 2018-03-25 18:25:09 +00:00
Luke Dashjr d558f44c58
Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ 2018-03-06 12:03:26 +08:00
Pieter Wuille 119b0f85e2 Split key_io (address/key encodings) off from base58 2018-02-19 18:55:21 -08:00
Alin Rus a73aab7cd8 Use the character based overload for std::string::find.
std::string::find has a character based overload as can be seen here
(4th oveload): http://www.cplusplus.com/reference/string/string/find/

Use that instead of constantly allocating temporary strings.
2018-01-11 21:40:51 +01:00
Akira Takizawa 595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
MeshCollider 1a445343f6 scripted-diff: Replace #include "" with #include <> (ryanofsky)
-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-
2017-11-16 08:23:01 +13:00
practicalswift 3e09b390b4 Use MakeUnique<T>(...) instead of std::unique_ptr<T>(new T(...)) 2017-11-09 16:53:34 +01:00
practicalswift 5a6f768896 Use unique_ptr for httpRPCTimerInterface (HTTPRPCTimerInterface) 2017-11-09 16:52:44 +01:00
Russell Yanofsky edafc718ad Fix uninitialized URI in batch RPC requests
This fixes "Wallet file not specified" errors when making batch wallet RPC
calls with more than one wallet loaded. This issue was reported by
NicolasDorier <nicolas.dorier@gmail.com>
https://github.com/bitcoin/bitcoin/issues/11257

Request URI is not used for anything except multiwallet request dispatching, so
this change has no other effects.

Fixes #11257
2017-10-03 15:25:00 -04:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
practicalswift 36d326e8b0 Use nullptr instead of zero (0) as the null pointer constant 2017-08-16 10:24:18 +02:00
Marko Bencun bb81e17355 scripted-diff: stop using the gArgs wrappers
They were temporary additions to ease the transition.

-BEGIN VERIFY SCRIPT-
find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g'
-END VERIFY SCRIPT-
2017-08-14 17:02:10 +02:00
Jonas Schnelli dd2185c291
Register wallet endpoint 2017-07-17 11:56:00 +02:00
Wladimir J. van der Laan 6dbcc74a0e
Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>
b1268a1 clang-format: Delete ForEachMacros (Jorge Timón)
5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón)
3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón)
33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón)
300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón)

Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
2017-07-04 18:05:18 +02:00
practicalswift aa95947ded Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
Jorge Timón ed866ab923
Indentation after 'Remove redundant calls to gArgs.IsArgSet()' 2017-06-27 07:39:52 +02:00
Jorge Timón 506b700dcb
Util: Remove redundant calls to gArgs.IsArgSet()
Return empty std::vector<std::string> with ArgsManager::GetArgs if
nothing is set for that string
2017-06-27 02:54:19 +02:00
Jorge Timón 5995735c5b
scripted-diff: Remove #include <boost/foreach.hpp>
-BEGIN VERIFY SCRIPT-
sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp
-END VERIFY SCRIPT-
2017-06-22 03:48:52 +02:00
Pieter Wuille 1ad3d4e126
Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPE
1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón)
18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón)
7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón)
a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón)

Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
2017-06-13 18:05:58 -07:00
practicalswift e53a0fa12a Remove duplicate includes 2017-06-09 15:39:37 +02:00
Jorge Timón 7c00c26726
scripted-diff: Fully remove BOOST_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-05 20:10:50 +02:00
Jorge Timón a5410ac5ec
Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal 2017-06-05 20:02:30 +02:00
Pieter Wuille c33652576c
Merge #10395: Replace boost::function with std::function (C++11)
1b936f5 Replace boost::function with std::function (C++11) (practicalswift)

Tree-SHA512: c4faec8cf3f801842010976115681f68ffa08fbc97ba50b22e95c936840f47e1b3bd8d7fd2f5b4e094b5a46bf3d29fc90b69d975a99e77322c0d19f8a00d53d3
2017-05-17 17:22:43 -07:00
practicalswift 1b936f5926 Replace boost::function with std::function (C++11) 2017-05-13 17:59:09 +02:00
Jorge Timón 78da882edd
Util: Small improvements in gArgs usage
- Don't check gArgs.IsArgSet() is greater than 0
- Remove unneeded calls and local variables
2017-05-09 21:37:34 +02:00
Jorge Timón b3cbd554d9
scripted-diff: Util: Encapsulate mapMultiArgs behind gArgs
-BEGIN VERIFY SCRIPT-
sed -i 's/mapMultiArgs.count(/gArgs.IsArgSet(/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i 's/mapMultiArgs.at("/gArgs.GetArgs("/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-05-09 21:29:05 +02:00
Gregory Maxwell 6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings.

This simplifies the acceptance testing by avoiding accessing a scoped
 static thread local pointer to a thread local set of strings.  It
 eliminates the only use of boost::thread_specific_ptr outside of
 lockorder debugging.

This change allows log entries to be directed to multiple categories
 and makes it easy to change the logging flags at runtime (e.g. via
 an RPC, though that isn't done by this commit.)

It also eliminates the fDebug global.

Configuration of unknown logging categories now produces a warning.
2017-04-01 18:53:29 +00:00
Pieter Wuille 914fad155d Make KEY_SIZE a compile-time constant 2017-02-17 11:42:22 -08:00
practicalswift cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
Pieter Wuille 99f001eb52 Fix memory leak in multiUserAuthorized 2017-01-12 11:52:53 -08:00