diff options
| author | Gavin Andresen <[email protected]> | 2011-09-26 06:06:16 -0700 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-09-26 06:06:16 -0700 |
| commit | 17e2c24645a10354849dec917b31f364e9056d58 (patch) | |
| tree | 0fc4eda5307bbc9dc99eb3c8fec40b303644cd1c /src/util.cpp | |
| parent | Merge pull request #521 from laanwj/qt (diff) | |
| parent | More denial-of-service misbehavior detection: version/addr/inv/getdata messages (diff) | |
| download | discoin-17e2c24645a10354849dec917b31f364e9056d58.tar.xz discoin-17e2c24645a10354849dec917b31f364e9056d58.zip | |
Merge pull request #517 from gavinandresen/DoSprevention
Denial-of-service prevention
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index 03b3d73e6..80095fe77 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() |