aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)Author
2012-04-23Merge pull request #1140 from jgarzik/sign-compareJeff Garzik
Address many more sign comparison warnings
2012-04-23Change signed->unsigned at 3 code sitesJeff Garzik
This resolves signed/unsigned comparison warnings.
2012-04-22Make GetDataDir return absolute pathsPieter Wuille
2012-04-21Integrate @JoelKatz's optimized ToHex (#562) into current HexStr functionWladimir J. van der Laan
2012-04-17Further reduce header dependenciesPieter Wuille
This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
2012-04-17Remove headers.hPieter Wuille
2012-04-12Remove obsolete Win32 AffinityBugWorkaround()Jeff Garzik
Reference miner exists for testnet-in-a-box type situations, and as a reference. We don't care enough about highly optimized internal mining to keep workarounds like this.
2012-04-11Use filesystem::path instead of manual string tinkeringPieter Wuille
Where possible, use boost::filesystem::path instead of std::string or char* for filenames. This avoids a lot of manual string tinkering, in favor of path::operator/. GetDataDir is also reworked significantly, it now only keeps two cached directory names (the network-specific data dir, and the root data dir), which are decided through a parameter instead of pre-initialized global variables. Finally, remove the "upgrade from 0.1.5" case where a debug.log in the current directory has to be removed.
2012-04-09Do not report spurious deadlocks caused by TRY_LOCKPieter Wuille
2012-04-09Use scoped locks instead of CRITICAL_BLOCKPieter Wuille
2012-04-04Locking system overhaul, add condition variablesPieter Wuille
This commit simplifies the locking system: CCriticalSection becomes a simple typedef for boost::interprocess::interprocess_recursive_mutex, and CCriticalBlock and CTryCriticalBlock are replaced by a templated CMutexLock, which wraps boost::interprocess::scoped_lock. By making the lock type a template parameter, some critical sections can now be changed to non-recursive locks, which support waiting via condition variables. These are implemented in CWaitableCriticalSection and WAITABLE_CRITICAL_BLOCK. CWaitableCriticalSection is a wrapper for a different Boost mutex, which supports waiting/notification via condition variables. This should enable us to remove much of the used polling code. Important is that this mutex is not recursive, so functions that perform the locking must not call eachother. Because boost::interprocess::scoped_lock does not support assigning and copying, I had to revert to the older CRITICAL_BLOCK macros that use a nested for loop instead of a simple if.
2012-04-04move translation function _ to qtui.h/noui.h instead of util.hWladimir J. van der Laan
2012-04-04remove dependency on serialize.h and util.h for SecureStringWladimir J. van der Laan
2012-04-03VC2010 compile fixesWladimir J. van der Laan
2012-03-26Begin doxygen-compatible commentsPieter Wuille
2012-03-25remove unused functions from util.h/util.cppWladimir J. van der Laan
2012-03-10Resolves issue #922 - "wallet passphrase timeout of several years doesn't work"Gregory Maxwell
2^31 milliseconds is only about 25 days. Also clamps Sleep() to 10 years, because it currently sleeps for 0 seconds when the sleep time would cross 2^31 seconds since the epoch. Hopefully boost will be fixed by 2028.
2012-02-26Reworked QT settingsGavin Andresen
2012-02-11Macros for manual critical sectionsPieter Wuille
2012-02-07Update all copyrights to 2012Gavin Andresen
2012-02-07Unit tests for the GetArg() methodsGavin Andresen
2012-02-06-bip16 option (default: 1) to support / not support BIP 16. And bumped ↵Gavin Andresen
default BIP16 switchover date from Feb 15 to Mar 1
2012-01-14Replace tabs with four spaces to comply with coding standard in doc/coding.txtLars Rasmusson
2012-01-13Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen
2012-01-06Network stack refactorPieter Wuille
This introduces CNetAddr and CService, respectively wrapping an (IPv6) IP address and an IP+port combination. This functionality used to be part of CAddress, which also contains network flags and connection attempt information. These extra fields are however not always necessary. These classes, along with logic for creating connections and doing name lookups, are moved to netbase.{h,cpp}, which does not depend on headers.h. Furthermore, CNetAddr is mostly IPv6-ready, though IPv6 functionality is not yet enabled for the application itself.
2012-01-03Fix issue #659, and cleanup wallet/command-line argument handling a bitGavin Andresen
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
2011-12-20Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr
2011-12-20Merge pull request #673 from mndrix/less-time-dataGavin Andresen
Store fewer time samples
2011-12-19Use std::numeric_limits<> for typesafe INT_MAX/etcGavin Andresen
2011-12-19Cleanup: removed dead code, and use C99 typedefs for int64 (supported by all ↵Gavin Andresen
modern c++ compilers)
2011-12-19Merge pull request #707 from gavinandresen/BIP14Gavin Andresen
Implement BIP 14 : separate protocol version from client version
2011-12-19Implement BIP 14 : separate protocol version from client versionGavin Andresen
2011-12-16Move more newlines out of strings, and fix translations.Gavin Andresen
2011-12-01Retain only the most recent time samplesMichael Hendricks
Remembering all time samples makes nTimeOffset slow to respond to system clock corrections. For instance, I start my node with a system clock that's 30 minutes slow and run it for a few days. During that time, I accumulate 10,000 offset samples with a median of 1800 seconds. Now I correct my system clock. Without this change, my node must collect another 10,000 samples before nTimeOffset is correct again. With this change, I must only accumulate 100 samples to correct the offset. Storing unlimited time samples also allows an attacker with many IP addresses (ex, a large botnet) to perform a memory exhaustion attack against Bitcoin nodes. The attacker sends a version message from each IP to his target, consuming more of the target's memory each time. Time samples are small, so this attack might be impractical under the old code, but it's impossible with the new code.
2011-11-26Implement an mlock()'d string class for storing passphrasesDylan Noblesmith
SecureString is identical to std::string except with secure_allocator substituting for std::allocator. This makes casting between them impossible, so converting between the two at API boundaries requires calling ::c_str() for now.
2011-11-02Cleaned up the critical section macros.Clark Gaebel
2011-10-07Fix build on windows and macGavin Andresen
Replaced all occurrences of #if* __WXMSW__ with WIN32, and all occurrences of __WXMAC_OSX__ with MAC_OSX, and made sure those are defined appropriately in the makefile and bitcoin-qt.pro.
2011-10-06Fix for 64bit buildVictor Leschuk
2011-09-30simpler ByteReverseNils Schneider
2011-09-30remove cryptopp dependency, add simple unittest for SHA256Transform()Nils Schneider
2011-09-30Merge pull request #524 from sipa/signandverifGavin Andresen
Sign and verify message with bitcoin address
2011-09-29Add assertion size>0 to MedianFilterWladimir J. van der Laan
2011-09-28Merge branch 'master' of https://github.com/bitcoin/bitcoinWladimir J. van der Laan
Conflicts: .gitignore (used upstream version) bitcoin-qt.pro
2011-09-28use median filter for peer-reported reported number of blocksWladimir J. van der Laan
- fixes problem that one misconfigured or malicious node can mess up progress bar - implementation in src/util.h - testcase in src/test/util_tests.cpp
2011-09-27Inline base64 encoder/decoderPieter Wuille
This replaces the openssl-based base64 encoder and decoder with a more efficient internal one. Tested against the rfc4648 test vectors. Decoder is based on JoelKatz' version.
2011-09-27Faster Base64 decoder.JoelKatz
2011-09-26Remove wxWidgetsGavin Andresen
Makefiles now build bitcoind only. qmake/make in top-level directory is used to build Bitcoin QT Deleted almost all #ifdef GUI from the code (left one possibly controversial one) Deleted xpm/ files.
2011-09-26Merge pull request #517 from gavinandresen/DoSpreventionGavin Andresen
Denial-of-service prevention
2011-09-21SetMockTime() for cleaner unit testingGavin Andresen