Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2011-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_QT_BANTABLEMODEL_H6#define BITCOIN_QT_BANTABLEMODEL_H8#include <addrdb.h>9#include <net.h>11#include <memory>13#include <QAbstractTableModel>14#include <QStringList>16class BanTablePriv;18namespace interfaces {19class Node;20}22struct CCombinedBan {23CSubNet subnet;24CBanEntry banEntry;25};27class BannedNodeLessThan28{29public:30BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :31column(nColumn), order(fOrder) {}32bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;34private:35int column;36Qt::SortOrder order;37};39/**40Qt model providing information about banned peers, similar to the41"getpeerinfo" RPC call. Used by the rpc console UI.42*/43class BanTableModel : public QAbstractTableModel44{45Q_OBJECT47public:48explicit BanTableModel(interfaces::Node& node, QObject* parent);49~BanTableModel();50void startAutoRefresh();51void stopAutoRefresh();53enum ColumnIndex {54Address = 0,55Bantime = 156};58/** @name Methods overridden from QAbstractTableModel59@{*/60int rowCount(const QModelIndex &parent) const override;61int columnCount(const QModelIndex &parent) const override;62QVariant data(const QModelIndex &index, int role) const override;63QVariant headerData(int section, Qt::Orientation orientation, int role) const override;64QModelIndex index(int row, int column, const QModelIndex &parent) const override;65Qt::ItemFlags flags(const QModelIndex &index) const override;66void sort(int column, Qt::SortOrder order) override;67/*@}*/69bool shouldShow();71bool unban(const QModelIndex& index);73public Q_SLOTS:74void refresh();76private:77interfaces::Node& m_node;78QStringList columns;79std::unique_ptr<BanTablePriv> priv;80};82#endif // BITCOIN_QT_BANTABLEMODEL_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.