mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge bitcoin/bitcoin#25989: init: abort if i2p/cjdns are chosen via -onlynet but are unreachable
68209a7b5crpc: make addpeeraddress work with cjdns addresses (Martin Zumsande)a8a9ed67ccinit: Abort if i2p/cjdns are chosen via -onlynet but unreachable (Martin Zumsande) Pull request description: If the networks i2p / cjdns are chosen via `-onlynet` but the user forgot to provide `-i2psam` / `-cjdnsreachable`, no outbound connections will be made - it would be nice to inform the user about that. The solution proposed here mimics existing behavior for `-onlynet=onion` and non-specified `-onion`/`-proxy` where we already abort with an InitError - if reviewers would prefer to just print a warning, please say so. The second commit adds CJDNS support to the debug-only `addpeeraddress` RPC allowing to add CJDNS addresses to addrman for testing and debug purposes. (if `-cjdnsreachable=1`) This is the result of an [IRC discussion](https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2022-09-01#848066;) with vasild. ACKs for top commit: vasild: ACK68209a7b5cdergoegge: ACK68209a7b5cTree-SHA512: 6db9787f01820190f14f90a0b39e4206603421eb7521f792879094d8bbf4d4d0bfd70665eadcc40994ac7941a15ab5a8d65c4779fba5634c0e6fa66eb0972b8d
This commit is contained in:
10
src/init.cpp
10
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user