Browse Source

net: define NodeId as an int64_t

This should make occurances of NodeId wrapping essentially impossible for
real-world usage.
0.15
Cory Fields 8 years ago
parent
commit
c851be4b25
  1. 2
      src/net.h
  2. 2
      src/qt/peertablemodel.cpp
  3. 4
      src/qt/rpcconsole.cpp

2
src/net.h

@ -92,7 +92,7 @@ static const ServiceFlags REQUIRED_SERVICES = NODE_NETWORK;
// NOTE: When adjusting this, update rpcnet:setban's help ("24h") // NOTE: When adjusting this, update rpcnet:setban's help ("24h")
static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban
typedef int NodeId; typedef int64_t NodeId;
struct AddedNodeInfo struct AddedNodeInfo
{ {

2
src/qt/peertablemodel.cpp

@ -166,7 +166,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
switch(index.column()) switch(index.column())
{ {
case NetNodeId: case NetNodeId:
return rec->nodeStats.nodeid; return (qint64)rec->nodeStats.nodeid;
case Address: case Address:
return QString::fromStdString(rec->nodeStats.addrName); return QString::fromStdString(rec->nodeStats.addrName);
case Subversion: case Subversion:

4
src/qt/rpcconsole.cpp

@ -1118,7 +1118,7 @@ void RPCConsole::disconnectSelectedNode()
for(int i = 0; i < nodes.count(); i++) for(int i = 0; i < nodes.count(); i++)
{ {
// Get currently selected peer address // Get currently selected peer address
NodeId id = nodes.at(i).data().toInt(); NodeId id = nodes.at(i).data().toLongLong();
// Find the node, disconnect it and clear the selected node // Find the node, disconnect it and clear the selected node
if(g_connman->DisconnectNode(id)) if(g_connman->DisconnectNode(id))
clearSelectedNode(); clearSelectedNode();
@ -1135,7 +1135,7 @@ void RPCConsole::banSelectedNode(int bantime)
for(int i = 0; i < nodes.count(); i++) for(int i = 0; i < nodes.count(); i++)
{ {
// Get currently selected peer address // Get currently selected peer address
NodeId id = nodes.at(i).data().toInt(); NodeId id = nodes.at(i).data().toLongLong();
// Get currently selected peer address // Get currently selected peer address
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id); int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id);

Loading…
Cancel
Save