Skip to content

Commit c851be4

Browse files
committed
net: define NodeId as an int64_t
This should make occurances of NodeId wrapping essentially impossible for real-world usage.
1 parent 471ed00 commit c851be4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static const ServiceFlags REQUIRED_SERVICES = NODE_NETWORK;
9292
// NOTE: When adjusting this, update rpcnet:setban's help ("24h")
9393
static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban
9494

95-
typedef int NodeId;
95+
typedef int64_t NodeId;
9696

9797
struct AddedNodeInfo
9898
{

src/qt/peertablemodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
166166
switch(index.column())
167167
{
168168
case NetNodeId:
169-
return rec->nodeStats.nodeid;
169+
return (qint64)rec->nodeStats.nodeid;
170170
case Address:
171171
return QString::fromStdString(rec->nodeStats.addrName);
172172
case Subversion:

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ void RPCConsole::disconnectSelectedNode()
11181118
for(int i = 0; i < nodes.count(); i++)
11191119
{
11201120
// Get currently selected peer address
1121-
NodeId id = nodes.at(i).data().toInt();
1121+
NodeId id = nodes.at(i).data().toLongLong();
11221122
// Find the node, disconnect it and clear the selected node
11231123
if(g_connman->DisconnectNode(id))
11241124
clearSelectedNode();
@@ -1135,7 +1135,7 @@ void RPCConsole::banSelectedNode(int bantime)
11351135
for(int i = 0; i < nodes.count(); i++)
11361136
{
11371137
// Get currently selected peer address
1138-
NodeId id = nodes.at(i).data().toInt();
1138+
NodeId id = nodes.at(i).data().toLongLong();
11391139

11401140
// Get currently selected peer address
11411141
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id);

0 commit comments

Comments
 (0)