diff --git a/bitcoin.cpp b/bitcoin.cpp index 6b61089..dd7da9a 100644 --- a/bitcoin.cpp +++ b/bitcoin.cpp @@ -275,9 +275,13 @@ public: int GetStartingHeight() { return nStartingHeight; } + + uint64_t GetServices() { + return you.nServices; + } }; -bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV, int &blocks, vector* vAddr) { +bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV, int &blocks, vector* vAddr, uint64_t& services) { try { CNode node(cip, vAddr); bool ret = node.Run(); @@ -289,6 +293,7 @@ bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV clientV = node.GetClientVersion(); clientSV = node.GetClientSubVersion(); blocks = node.GetStartingHeight(); + services = node.GetServices(); // printf("%s: %s!!!\n", cip.ToString().c_str(), ret ? "GOOD" : "BAD"); return ret; } catch(std::ios_base::failure& e) { diff --git a/bitcoin.h b/bitcoin.h index 2ae9ffe..bd2ed7b 100644 --- a/bitcoin.h +++ b/bitcoin.h @@ -3,6 +3,6 @@ #include "protocol.h" -bool TestNode(const CService &cip, int &ban, int &client, std::string &clientSV, int &blocks, std::vector* vAddr); +bool TestNode(const CService &cip, int &ban, int &client, std::string &clientSV, int &blocks, std::vector* vAddr, uint64_t& services); #endif diff --git a/db.cpp b/db.cpp index 1574bfb..1474a79 100644 --- a/db.cpp +++ b/db.cpp @@ -69,7 +69,7 @@ int CAddrDb::Lookup_(const CService &ip) { return -1; } -void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, int blocks) { +void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, int blocks, uint64_t services) { int id = Lookup_(addr); if (id == -1) return; unkId.erase(id); @@ -78,6 +78,7 @@ void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, int info.clientVersion = clientV; info.clientSubVersion = clientSV; info.blocks = blocks; + info.services = services; info.Update(true); if (info.IsGood() && goodId.count(id)==0) { goodId.insert(id); diff --git a/db.h b/db.h index 55e1149..9f06ce2 100644 --- a/db.h +++ b/db.h @@ -183,6 +183,7 @@ public: struct CServiceResult { CService service; + uint64_t services; bool fGood; int nBanTime; int nHeight; @@ -215,7 +216,7 @@ protected: void Add_(const CAddress &addr, bool force); // add an address bool Get_(CServiceResult &ip, int& wait); // get an IP to test (must call Good_, Bad_, or Skipped_ on result afterwards) bool GetMany_(std::vector &ips, int max, int& wait); - void Good_(const CService &ip, int clientV, std::string clientSV, int blocks); // mark an IP as good (must have been returned by Get_) + void Good_(const CService &ip, int clientV, std::string clientSV, int blocks, uint64_t services); // mark an IP as good (must have been returned by Get_) void Bad_(const CService &ip, int ban); // mark an IP as bad (and optionally ban it) (must have been returned by Get_) void Skipped_(const CService &ip); // mark an IP as skipped (must have been returned by Get_) int Lookup_(const CService &ip); // look up id of an IP @@ -313,9 +314,9 @@ public: for (int i=0; i