std::string IdentityNode(const CNode *pnode) {
    if (fLogIPs)
      return "pnode->addr.ToString();
    else
      return strprintf("%d", pnode->GetId());
  }

Use a function like that, please?