mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 05:49:11 +01:00
db747ea384
3bcc0059b8
Add lint-include-guards.sh which checks include guard consistency (practicalswift)8fd6af89a0
Fix missing or inconsistent include guards (practicalswift)8af65d96f4
Document include guard convention (practicalswift) Pull request description: * **Documentation**: Document include guard convention * **Fix**: Fix missing or inconsistent include guards * **Regression test**: Add `lint-include-guards.sh` which checks include guard consistency Tree-SHA512: 8171878f60fd08ccbea943a11e835195750592abb9d7ab74eaa4265ae7fac523b1da9d31ca13d6ab73dd596e49986bfb7593c696e5f39567c93e610165bc2acc Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # src/bech32.h # src/consensus/merkle.h # src/key_io.h # src/policy/fees.h # src/rpc/server.h # src/script/bitcoinconsensus.h # src/wallet/coinselection.h
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// Copyright (c) 2014-2019 The Dash Core developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_NETFULFILLEDMAN_H
|
|
#define BITCOIN_NETFULFILLEDMAN_H
|
|
|
|
#include <netaddress.h>
|
|
#include <serialize.h>
|
|
#include <sync.h>
|
|
|
|
class CNetFulfilledRequestManager;
|
|
extern CNetFulfilledRequestManager netfulfilledman;
|
|
|
|
// Fulfilled requests are used to prevent nodes from asking for the same data on sync
|
|
// and from being banned for doing so too often.
|
|
class CNetFulfilledRequestManager
|
|
{
|
|
private:
|
|
typedef std::map<std::string, int64_t> fulfilledreqmapentry_t;
|
|
typedef std::map<CService, fulfilledreqmapentry_t> fulfilledreqmap_t;
|
|
|
|
//keep track of what node has/was asked for and when
|
|
fulfilledreqmap_t mapFulfilledRequests;
|
|
CCriticalSection cs_mapFulfilledRequests;
|
|
|
|
void RemoveFulfilledRequest(const CService& addr, const std::string& strRequest);
|
|
|
|
public:
|
|
CNetFulfilledRequestManager() {}
|
|
|
|
ADD_SERIALIZE_METHODS;
|
|
|
|
template <typename Stream, typename Operation>
|
|
inline void SerializationOp(Stream& s, Operation ser_action) {
|
|
LOCK(cs_mapFulfilledRequests);
|
|
READWRITE(mapFulfilledRequests);
|
|
}
|
|
|
|
void AddFulfilledRequest(const CService& addr, const std::string& strRequest);
|
|
bool HasFulfilledRequest(const CService& addr, const std::string& strRequest);
|
|
|
|
void RemoveAllFulfilledRequests(const CService& addr);
|
|
|
|
void CheckAndRemove();
|
|
void Clear();
|
|
|
|
std::string ToString() const;
|
|
|
|
void DoMaintenance();
|
|
};
|
|
|
|
#endif // BITCOIN_NETFULFILLEDMAN_H
|