diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2017-04-10 15:00:23 -0400 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-04-14 10:35:49 +0200 |
commit | 30fa231011a63404a087420a9de7271af077affa (patch) | |
tree | c719ebdc883edf98ae982994b76104432e38e64e /src | |
parent | 3c796026e56abddf1b37128c0478532a371b5f9f (diff) |
net: define NodeId as an int64_t
This should make occurances of NodeId wrapping essentially impossible for
real-world usage.
Github-Pull: #10176
Rebased-From: c851be4b25905977ca471c42435dc590fd2ff2f5
Diffstat (limited to 'src')
-rw-r--r-- | src/net.h | 2 | ||||
-rw-r--r-- | src/qt/peertablemodel.cpp | 2 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
@@ -92,7 +92,7 @@ static const ServiceFlags REQUIRED_SERVICES = NODE_NETWORK; // NOTE: When adjusting this, update rpcnet:setban's help ("24h") static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban -typedef int NodeId; +typedef int64_t NodeId; struct AddedNodeInfo { diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 974a71ddca..fff072fd4c 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -166,7 +166,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const switch(index.column()) { case NetNodeId: - return rec->nodeStats.nodeid; + return (qint64)rec->nodeStats.nodeid; case Address: return QString::fromStdString(rec->nodeStats.addrName); case Subversion: diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 001f199264..77e5e03e64 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1115,7 +1115,7 @@ void RPCConsole::disconnectSelectedNode() for(int i = 0; i < nodes.count(); i++) { // 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 if(g_connman->DisconnectNode(id)) clearSelectedNode(); @@ -1132,7 +1132,7 @@ void RPCConsole::banSelectedNode(int bantime) for(int i = 0; i < nodes.count(); i++) { // Get currently selected peer address - NodeId id = nodes.at(i).data().toInt(); + NodeId id = nodes.at(i).data().toLongLong(); // Get currently selected peer address int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id); |