Hush Full Node software. We were censored from Github, this is where all development happens now. https://hush.is
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.1 KiB

// Copyright (c) 2014 The Bitcoin Core developers
// Copyright (c) 2016-2024 The Hush developers
// Copyright (c) 2020 The Zcash developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#ifndef HUSH_TIMEDATA_H
#define HUSH_TIMEDATA_H
#include <set>
#include <stdint.h>
#include "netbase.h"
#include "sync.h"
class CTimeWarning
{
private:
CCriticalSection cs;
std::set<CNetAddr> setKnown;
size_t nPeersAhead;
size_t nPeersBehind;
public:
static const size_t TIMEDATA_WARNING_SAMPLES = 8;
static const size_t TIMEDATA_WARNING_MAJORITY = 6;
static const size_t TIMEDATA_MAX_SAMPLES = 20;
static const int64_t TIMEDATA_WARNING_THRESHOLD = 10 * 60;
static const int64_t TIMEDATA_IGNORE_THRESHOLD = 10 * 24 * 60 * 60;
CTimeWarning() : nPeersBehind(0), nPeersAhead(0) {}
virtual ~CTimeWarning() {}
int64_t AddTimeData(const CNetAddr& ip, int64_t nTime, int64_t now);
virtual void Warn(size_t peersAhead, size_t peersBehind);
};
extern CTimeWarning timeWarning;
#endif // HUSH_TIMEDATA_H