aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-09-21 16:31:09 +0100
committerfanquake <fanquake@gmail.com>2022-09-21 16:33:49 +0100
commit05f7937810269d3582e675255780756138954801 (patch)
tree297e247f7baa01c96184db2408080f20754f5841 /src/init.cpp
parentce3cb2bbe79cf33e495ea97a1d4fa4b61ad74ab9 (diff)
parent68209a7b5c0326e14508d9cf749771605bd6ffe7 (diff)
downloadbitcoin-05f7937810269d3582e675255780756138954801.tar.xz
Merge bitcoin/bitcoin#26145: [24.x] init: abort if i2p/cjdns are chosen via -onlynet but are unreachable
68209a7b5c0326e14508d9cf749771605bd6ffe7 rpc: make addpeeraddress work with cjdns addresses (Martin Zumsande) a8a9ed67cc447d204304ccfd844c45fd76486c6a init: Abort if i2p/cjdns are chosen via -onlynet but unreachable (Martin Zumsande) Pull request description: Identical commit from https://github.com/bitcoin/bitcoin/pull/25989 ACKs for top commit: fanquake: ACK 68209a7b5c0326e14508d9cf749771605bd6ffe7 Tree-SHA512: eec335df06b4c209cfe3473cb623828effd00c45a5dd605bb920edd265de1c789627482b005a51e89b8fc79cc4c5d26ff1fc306f2e4573897c5c7f083aa22861
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index ad894f7f11..25b40c6c6e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1285,6 +1285,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
if (!args.IsArgSet("-cjdnsreachable")) {
+ if (args.IsArgSet("-onlynet") && IsReachable(NET_CJDNS)) {
+ return InitError(
+ _("Outbound connections restricted to CJDNS (-onlynet=cjdns) but "
+ "-cjdnsreachable is not provided"));
+ }
SetReachable(NET_CJDNS, false);
}
// Now IsReachable(NET_CJDNS) is true if:
@@ -1757,6 +1762,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
SetProxy(NET_I2P, Proxy{addr});
} else {
+ if (args.IsArgSet("-onlynet") && IsReachable(NET_I2P)) {
+ return InitError(
+ _("Outbound connections restricted to i2p (-onlynet=i2p) but "
+ "-i2psam is not provided"));
+ }
SetReachable(NET_I2P, false);
}