aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bantablemodel.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2023-03-06 12:49:39 +0100
committerVasil Dimov <vd@FreeBSD.org>2023-03-06 16:06:05 +0100
commita981af4e6fd0047bc3e96468db48dd7820dac808 (patch)
treebc01cd177af39391ad7886849f646276ec8e0df9 /src/qt/bantablemodel.cpp
parent40c6c85c05812ee8bf824b639307b1ac17a001c4 (diff)
downloadbitcoin-a981af4e6fd0047bc3e96468db48dd7820dac808.tar.xz
gui: use the stored CSubNet entry when unbanning
The previous code visualized the `CSubNet` object as string, then parsed that string back to `CSubNet`. This is sub-optimal given that the original `CSubNet` object can be used directly instead. This avoids calling `LookupSubNet()` from the GUI. Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
Diffstat (limited to 'src/qt/bantablemodel.cpp')
-rw-r--r--src/qt/bantablemodel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
index 4f57cd4457..d68ca1e2ea 100644
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -178,3 +178,9 @@ bool BanTableModel::shouldShow()
{
return priv->size() > 0;
}
+
+bool BanTableModel::unban(const QModelIndex& index)
+{
+ CCombinedBan* ban{static_cast<CCombinedBan*>(index.internalPointer())};
+ return ban != nullptr && m_node.unban(ban->subnet);
+}