Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/bitcoin.cpp
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::VERSION) { | ||||
| int64_t nTime; | int64_t nTime; | ||||
| CService addrMe; | CService addrMe; | ||||
| uint64_t nNonce = 1; | uint64_t nNonce = 1; | ||||
| uint64_t nServiceInt; | uint64_t nServiceInt; | ||||
| recv >> nVersion >> nServiceInt >> nTime; | recv >> nVersion >> nServiceInt >> nTime; | ||||
| yourServices = ServiceFlags(nServiceInt); | yourServices = ServiceFlags(nServiceInt); | ||||
| // Ignore the addrMe service bits sent by the peer | // Ignore the addrMe service bits sent by the peer | ||||
| recv.ignore(8); | recv.ignore(8); | ||||
| recv >> addrMe; | recv >> WithParams(CNetAddr::V1, addrMe); | ||||
| // The version message includes information about the sending node | // The version message includes information about the sending node | ||||
| // which we don't use: | // which we don't use: | ||||
| // - 8 bytes (service bits) | // - 8 bytes (service bits) | ||||
| // - 16 bytes (ipv6 address) | // - 16 bytes (ipv6 address) | ||||
| // - 2 bytes (port) | // - 2 bytes (port) | ||||
| recv.ignore(26); | recv.ignore(26); | ||||
| recv >> nNonce; | recv >> nNonce; | ||||
| Show All 29 Lines | if (strCommand == NetMsgType::VERACK) { | ||||
| } | } | ||||
| doneAfter = Now<NodeSeconds>() + doneAfterDelta; | doneAfter = Now<NodeSeconds>() + doneAfterDelta; | ||||
| return PeerMessagingState::AwaitingMessages; | return PeerMessagingState::AwaitingMessages; | ||||
| } | } | ||||
| if (strCommand == NetMsgType::ADDR && vAddr) { | if (strCommand == NetMsgType::ADDR && vAddr) { | ||||
| needAddrReply = false; | needAddrReply = false; | ||||
| std::vector<CAddress> vAddrNew; | std::vector<CAddress> vAddrNew; | ||||
| recv >> vAddrNew; | recv >> WithParams(CAddress::V1_NETWORK, vAddrNew); | ||||
| // tfm::format(std::cout, "%s: got %i addresses\n", | // tfm::format(std::cout, "%s: got %i addresses\n", | ||||
| // ToString(you), | // ToString(you), | ||||
| // (int)vAddrNew.size()); | // (int)vAddrNew.size()); | ||||
| auto now = Now<NodeSeconds>(); | auto now = Now<NodeSeconds>(); | ||||
| std::vector<CAddress>::iterator it = vAddrNew.begin(); | std::vector<CAddress>::iterator it = vAddrNew.begin(); | ||||
| if (vAddrNew.size() > 1) { | if (vAddrNew.size() > 1) { | ||||
| if (checkpointVerified && | if (checkpointVerified && | ||||
| (TicksSinceEpoch<std::chrono::seconds>(doneAfter) == 0 || | (TicksSinceEpoch<std::chrono::seconds>(doneAfter) == 0 || | ||||
| ▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | bool CSeederNode::Run() { | ||||
| uint8_t fRelayTxs = 0; | uint8_t fRelayTxs = 0; | ||||
| const std::string clientName = gArgs.GetArg("-uaclientname", CLIENT_NAME); | const std::string clientName = gArgs.GetArg("-uaclientname", CLIENT_NAME); | ||||
| const std::string clientVersion = | const std::string clientVersion = | ||||
| gArgs.GetArg("-uaclientversion", FormatVersion(CLIENT_VERSION)); | gArgs.GetArg("-uaclientversion", FormatVersion(CLIENT_VERSION)); | ||||
| const std::string userAgent = | const std::string userAgent = | ||||
| FormatUserAgent(clientName, clientVersion, {"seeder"}); | FormatUserAgent(clientName, clientVersion, {"seeder"}); | ||||
| MessageWriter::WriteMessage(vSend, NetMsgType::VERSION, PROTOCOL_VERSION, | MessageWriter::WriteMessage( | ||||
| nLocalServices, GetTime(), your_services, you, | vSend, NetMsgType::VERSION, PROTOCOL_VERSION, nLocalServices, GetTime(), | ||||
| my_services, CService(), nLocalNonce, userAgent, | your_services, WithParams(CNetAddr::V1, you), my_services, | ||||
| WithParams(CNetAddr::V1, CService{}), nLocalNonce, userAgent, | |||||
| GetRequireHeight(), fRelayTxs); | GetRequireHeight(), fRelayTxs); | ||||
| Send(); | Send(); | ||||
| bool res = true; | bool res = true; | ||||
| NodeSeconds now; | NodeSeconds now; | ||||
| while (now = Now<NodeSeconds>(), | while (now = Now<NodeSeconds>(), | ||||
| ban == 0 && | ban == 0 && | ||||
| (TicksSinceEpoch<std::chrono::seconds>(doneAfter) == 0 || | (TicksSinceEpoch<std::chrono::seconds>(doneAfter) == 0 || | ||||
| doneAfter > now) && | doneAfter > now) && | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||