aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-09-26 06:06:16 -0700
committerGavin Andresen <gavinandresen@gmail.com>2011-09-26 06:06:16 -0700
commit17e2c24645a10354849dec917b31f364e9056d58 (patch)
tree0fc4eda5307bbc9dc99eb3c8fec40b303644cd1c /src/util.cpp
parentf7f2a36925bb560363f691fc3ca3dec83830dd15 (diff)
parent806704c237890527ca2a7bab4c97550431eebea0 (diff)
downloadbitcoin-17e2c24645a10354849dec917b31f364e9056d58.tar.xz
Merge pull request #517 from gavinandresen/DoSprevention
Denial-of-service prevention
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 03b3d73e62..80095fe771 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -813,11 +813,20 @@ void ShrinkDebugFile()
// - Median of other nodes's clocks
// - The user (asking the user to fix the system clock if the first two disagree)
//
+static int64 nMockTime = 0; // For unit testing
+
int64 GetTime()
{
+ if (nMockTime) return nMockTime;
+
return time(NULL);
}
+void SetMockTime(int64 nMockTimeIn)
+{
+ nMockTime = nMockTimeIn;
+}
+
static int64 nTimeOffset = 0;
int64 GetAdjustedTime()