Commit Graph

42 Commits

Author SHA1 Message Date
Kris Nuttycombe 3cec519ce4 scripted-diff: Update Zcash copyrights to 2023
-BEGIN VERIFY SCRIPT-
for party in "The Zcash developers" "The Bitcoin Core developers" "Bitcoin Developers"; do
  sed -i"" -e "s#Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? $party#Copyright (c) \1-2023 $party#" COPYING
  sed -i"" -e "s#\(.*\)\([0-9]\{4\}\)\(-[0-9]\{4\}\)\, $party#\1\2-2023, $party#" contrib/debian/copyright
done

sed -i"" -e "s/define(_COPYRIGHT_YEAR, [0-9]\{4\})/define(_COPYRIGHT_YEAR, 2023)/" configure.ac
sed -i"" -e "s/#define COPYRIGHT_YEAR [0-9]\{4\}/#define COPYRIGHT_YEAR 2023/" src/clientversion.h

git grep "^// Copyright (c) .* The Zcash developers" \
  | awk -F ':' '{print $1}' \
  | xargs -I {} sed -i"" -e "s#// Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? The Zcash developers#// Copyright (c) \1-2023 The Zcash developers#" {}
-END VERIFY SCRIPT-
2023-01-23 11:31:54 -07:00
Jim Posen 9a7e2c153d 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/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 -e 's/"util\.h"/"util\/system\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
git checkout HEAD -- src/secp256k1 # exclude secp256k1, which has its own "util.h"
sed -i -e 's/"utilmoneystr\.h"/"util\/moneystr\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utilstrencodings\.h"/"util\/strencodings\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utiltime\.h"/"util\/time\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i -e 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i -e 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i -e 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i -e 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i -e 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i -e 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i -e 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i -e 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i -e 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
-END VERIFY SCRIPT-
2022-07-01 17:50:09 -06:00
Russell Yanofsky 9ff8ae6419 Add unit test for DEBUG_LOCKORDER code
(cherry picked from commit bitcoin/bitcoin@41b88e9337)
2022-05-14 01:25:08 +00:00
MarcoFalke 130871cb4f qa: Initialize lockstack to prevent null pointer deref
(cherry picked from commit bitcoin/bitcoin@fa9da85b7c)
2022-05-14 01:25:08 +00:00
Chun Kuan Lee 1c255a2fd6 break circular dependency: random/sync -> util -> random/sync
(cherry picked from commit bitcoin/bitcoin@84f41946b9)
2022-05-14 01:25:08 +00:00
John Newbery 6e401910e7 [logging] Comment all continuing logs.
Most logs should terminated with a '\n'. Some logs
are built up over multiple calls to logPrintf(), so
do not need a newline terminater. Comment all of
these 'continued' logs as a linter hing.

Zcash: Only the log lines we have. We also use a Rust logger that
doesn't actually support this kind of logging, but these annotations are
useful for knowing where to add potential future support.

(cherry picked from commit bitcoin/bitcoin@5c21e6c6d3)
2022-05-14 01:25:08 +00:00
practicalswift 474aefcde6 Fix typos
Zcash: Only the typos we have.

(cherry picked from commit bitcoin/bitcoin@1340eda3b7)
2022-05-14 01:25:08 +00:00
Cory Fields f1c166d3db threads: add a thread_local autoconf check
(cherry picked from commit bitcoin/bitcoin@f7f7e2cd34)
2022-05-14 01:25:08 +00:00
Thomas Snider 4ad38a45e5 Switched sync.{cpp,h} to std threading primitives.
(cherry picked from commit bitcoin/bitcoin@bba9bd0d9d)
2022-05-14 01:25:08 +00:00
João Barbosa e5d2a3a5a2 Remove unused fTry from push_lock
(cherry picked from commit bitcoin/bitcoin@92848e5058)
2022-05-14 01:25:08 +00:00
practicalswift 85fdbf3af8 Remove unused code
Zcash: Excludes code that is still in use for us.

(cherry picked from commit bitcoin/bitcoin@8dc957ae06)
2022-05-14 01:25:08 +00:00
Matt Corallo b031444591 Further-enforce lockordering by enforcing directly after TRY_LOCKs
(cherry picked from commit bitcoin/bitcoin@618ee9249b)
2022-05-14 01:25:08 +00:00
Matt Corallo 709b11769d Always enforce lock strict lock ordering (try or not)
(cherry picked from commit bitcoin/bitcoin@8465631845)
2022-05-14 01:25:08 +00:00
Kris Nuttycombe d9aeefc54a scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017
-BEGIN VERIFY SCRIPT-
grep -l "Copyright" $(grep -L "The Zcash developers" $(git diff --name-only --diff-filter=ACM 94f427a211bb337200c29a1e19be0f5ad2f171b0..b2a114a8c99947b66d1fbdc70278f13e7a415d2a -- src/ test/ zcutil/ qa/)) | xargs -I {} sed -i"" -e "s#\(\(.*\)Copyright (c) .* The Bitcoin Core developers\)#\1\n\2Copyright (c) 2017-2022 The Zcash developers#" {}
-END VERIFY SCRIPT-
2022-05-11 17:25:51 -06:00
Akio Nakamura e3ed38d19c Prevent mutex lock fail even if --enable-debug
This PR intends to resolve #15227.

"configure --debug-enabled" enables "#ifdef DEBUG_LOCKORDER".
Then "lockdata" (in sync.cpp) will be initialized same as other
static objects.

But unfortunately, lockdata.push_lock() was called before its
initialization (via initializing signatureCache which is declared
in script/sigcache.cpp) on macOS.

This PR apply the "Construct On First Use Idiom" to "lockdata"
to prevent it.

(cherry picked from commit b09dab0f2de37be3c96f5087ee7bd61d7262aa76)
2021-04-20 15:11:57 +12:00
Matt Corallo 756a33ace4 Add ability to assert a lock is not held in DEBUG_LOCKORDER
zcash: cherry picked from commit 2b4b34503ff0ed44365d83a68ffed2736ea9cc51
zcash: https://github.com/bitcoin/bitcoin/pull/10286
2021-04-12 17:15:22 -06:00
Pieter Wuille 41713465f5 Clean up lockorder data of destroyed mutexes
The lockorder potential deadlock detection works by remembering for each
lock A that is acquired while holding another B the pair (A,B), and
triggering a warning when (B,A) already exists in the table.

A and B in the above text are represented by pointers to the CCriticalSection
object that is acquired. This does mean however that we need to clean up the
table entries that refer to any critical section which is destroyed, as it
memory address can potentially be used for another unrelated lock in the future.

Implement this clean up by remembering not only the pairs in forward direction,
but also backward direction. This allows for fast iteration over all pairs that
use a deleted CCriticalSection in either the first or the second position.

zcash: cherry picked from commit 5eeb913d6cff9cfe9a6769d7efe4a7b9f23de0f4
zcash: https://github.com/bitcoin/bitcoin/pull/7846
2021-02-19 15:11:22 -07:00
Jorge Timón c3983ccb1c 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-
2020-11-23 23:07:15 +00:00
Jorge Timón f5e98e0fb1 scripted-diff: Remove PAIRTYPE
Zcash: Added an extra command to handle cases where the pair were not
separated by a space.

-BEGIN VERIFY SCRIPT-
sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i 's/PAIRTYPE(\([^,]*\),\([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#define std::pair<t1, t2>    std::pair<t1, t2>\n//' ./src/utilstrencodings.h ;
-END VERIFY SCRIPT-
2020-11-23 23:07:15 +00:00
Jorge Timón 92a867febc 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-
2020-11-23 23:07:15 +00:00
Daira Hopwood bc909a7a7f Replace http with https: in links to the MIT license.
Also change MIT/X11 to just MIT, since no distinction was intended.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 15:26:01 +01:00
Matt Corallo 8e4bc69d1f
Assert on probable deadlocks if the second lock isnt try_lock 2017-03-03 11:47:02 -08:00
Matt Corallo 1ec900a29e Remove broken+useless lock/unlock log prints 2015-04-24 02:28:47 -07:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01:00
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Pieter Wuille 20e01b1a03 Apply clang-format on some infrequently-updated files 2014-09-19 19:21:46 +02:00
Philip Kaufmann 611116d4e3 header include cleanup
- ensures alphabetical ordering for includes etc. in source file headers
2014-09-14 12:43:56 +02:00
Wladimir J. van der Laan d2d6f708e4 Fix build with DEBUG_LOCKORDER
Fixes #4771
2014-08-28 01:52:22 +02:00
Gavin Andresen ca4cf5cff6 Wallet locking fixes for -DDEBUG_LOCKORDER
Compiling with -DDEBUG_LOCKORDER and running the qa/rpc-test/ regression
tests uncovered a couple of wallet methods that should (but didn't)
acquire the cs_wallet mutext.

I also changed the AssertLockHeld() routine print to stderr and
abort, instead of printing to debug.log and then assert()'ing.
It is annoying to look in debug.log to find out which
AssertLockHeld is failing.
2014-02-18 12:11:46 -05:00
Wladimir J. van der Laan 7d9d134bf9 Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing
actual std::string objects.

Remove unnecessary c_str calls (236 of them) in logging and formatting.
2014-01-23 16:05:01 +01:00
Wladimir J. van der Laan 19a5676280 Use mutex pointer instead of name for AssertLockHeld
This makes it useable for non-global locks such as the wallet and
keystore locks.
2013-12-19 09:46:11 +01:00
Gavin Andresen c649637b6c mutex debugging routines: LocksHeld() and AssertLockHeld() 2013-11-29 17:46:19 +10:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
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.
2013-11-10 09:36:28 -06:00
Gavin Andresen 3b9ecfed82 Make -DDEBUGLOCKORDER + -debug less noisy
Print out every mutex lock/unlock if compiled -DDEBUGLOCKORDER
only if -debug=lock is set.
2013-10-20 15:41:15 +10:00
Gavin Andresen 881a85a22d Replace printf with LogPrintf / LogPrint 2013-09-18 20:39:25 +10:00
Jeff Garzik ea0796bde3 Trim trailing whitespace for src/*.{h,cpp} 2012-09-18 15:07:58 -04:00
fanquake e749405297 Fix a few typos 2012-06-29 17:26:45 +08:00
Matt Corallo 4d009243cb Fix DEBUG_LOCKCONTENTION 2012-06-05 16:13:16 +02:00
Pieter Wuille 46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Pieter Wuille 660ff174f2 Use boost::thread locking instead of interprocess 2012-05-18 16:56:12 +02:00
Fordy 3a25a2b9b0 Update License in File Headers
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.
2012-05-18 22:02:28 +08:00
Pieter Wuille 7f3ccb59da Split synchronization mechanisms from util.{h,cpp} 2012-05-11 18:13:51 +02:00