19 #define BITCOIN_SEED_NONCE 0x0539a019ca550825ULL 47 recv >>
nVersion >> nServiceInt >> nTime >> addrMe;
49 recv >> addrFrom >> nNonce;
64 std::vector<BlockHash> locatorHash(
76 std::vector<CAddress> vAddrNew;
82 std::vector<CAddress>::iterator it = vAddrNew.begin();
83 if (vAddrNew.size() > 1) {
88 while (it != vAddrNew.end()) {
94 if (addr.
nTime <= 100000000 || addr.
nTime > now + 600) {
95 addr.
nTime = now - 5 * 86400;
97 if (addr.
nTime > now - 604800) {
98 vAddr->push_back(addr);
124 uint32_t nHeaderSize =
126 if (
vRecv.
end() - pstart < nHeaderSize) {
137 if (!hdr.IsValidWithoutConfig(netMagic)) {
143 std::string strCommand = hdr.GetCommand();
144 unsigned int nMessageSize = hdr.nMessageSize;
157 if (memcmp(hash.
begin(), hdr.pchChecksum,
188 bool connected =
false;
192 bool proxyConnectionFailed =
false;
201 proxyConnectionFailed);
222 uint64_t nLocalServices = 0;
226 std::string ver =
"/bitcoin-cash-seeder:0.15/";
228 nLocalServices,
GetTime(),
you, me, nLocalNonce,
236 char pchBuf[0x10000];
240 FD_ZERO(&fdsetError);
241 FD_SET(
sock, &fdsetRecv);
242 FD_SET(
sock, &fdsetError);
251 int ret = select(
sock + 1, &fdsetRecv,
nullptr, &fdsetError, &wa);
258 int nBytes = recv(
sock, pchBuf,
sizeof(pchBuf), 0);
262 memcpy(&
vRecv[nPos], pchBuf, nBytes);
263 }
else if (nBytes == 0) {
283 return (
ban == 0) && res;
unsigned short GetPort() const
bool ConnectSocketDirectly(const CService &addrConnect, const SOCKET &hSocket, int nTimeout, bool manual_connection)
Try to connect to the specified service on the specified socket.
vector_type::iterator iterator
ServiceFlags
nServices flags.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
const char * GETADDR
The getaddr message requests an addr message from the receiving node, preferably one with lots of IP ...
void resize(size_type n, value_type c=0)
Double ended buffer combining vector and stream-like interfaces.
iterator erase(iterator it)
enum Network GetNetwork() const
iterator insert(iterator it, const char x=char())
size_t GetSerializeSize(const T &t, int nVersion=0)
bool ConnectThroughProxy(const proxyType &proxy, const std::string &strDest, int port, const SOCKET &hSocket, int nTimeout, bool &outProxyConnectionFailed)
Connect to a specified destination service through a SOCKS5 proxy by first connecting to the SOCKS5 p...
CSeederNode(const CService &ip, std::vector< CAddress > *vAddrIn)
Block-chain checkpoints are compiled-in sanity checks.
const char * GETHEADERS
The getheaders message requests a headers message that provides block headers starting from a particu...
PeerMessagingState ProcessMessage(std::string strCommand, CDataStream &recv)
std::string ToStringIP() const
A combination of a network address (CNetAddr) and a (TCP) port.
A CService with information about it as peer.
static int GetRequireHeight()
const char * ADDR
The addr (IP address) message relays connection information for peers on the network.
uint256 Hash(const T1 pbegin, const T1 pend)
Compute the 256-bit hash of an object.
#define BITCOIN_SEED_NONCE
static const uint64_t MAX_SIZE
bool CloseSocket(SOCKET &hSocket)
Close socket and set hSocket to INVALID_SOCKET.
static const unsigned int ADDR_SOFT_CAP
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
const_iterator end() const
const_iterator begin() const
const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
static void WriteMessage(CDataStream &stream, std::string command, Args &&... args)
const CChainParams & Params()
Return the currently selected parameters.
static const int PROTOCOL_VERSION
network protocol versioning
SOCKET CreateSocket(const CService &addrConnect)
Try to create a socket file descriptor with specific properties in the communications domain (address...
std::vector< CAddress > * vAddr
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
int64_t GetTime()
Return system time (or mocked time, if set)
const CMessageHeader::MessageMagic & NetMagic() const