mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #19473: net: Add -networkactive option
2aac093a3dtest: Add test coverage for -networkactive option (Hennadii Stepanov)3c58129b12net: Log network activity status change unconditionally (Hennadii Stepanov)62fe6aa87enet: Add -networkactive option (Hennadii Stepanov) Pull request description: Some Bitcoin Core activity is completely local (offline), e.g., reindexing. The `setnetworkactive` RPC command is already present. This PR adds the corresponding command-line argument / config option, and allows to start the client with disabled p2p network by providing `-networkactive=0` or `-nonetworkactive`. This was done while reviewing #16981. ACKs for top commit: MarcoFalke: re-ACK2aac093a3d🏠 LarryRuane: ACK2aac093a3dTree-SHA512: 446d791b46d7b556d7694df7b1f88cd4fbc09301fe4eaf036b45cb8166ed806156353cc03788a07b633d5887d5eee30a7c02a2d4307141c8ccc75e0a88145636
This commit is contained in:
@@ -2253,7 +2253,7 @@ void Discover()
|
||||
|
||||
void CConnman::SetNetworkActive(bool active)
|
||||
{
|
||||
LogPrint(BCLog::NET, "SetNetworkActive: %s\n", active);
|
||||
LogPrintf("%s: %s\n", __func__, active);
|
||||
|
||||
if (fNetworkActive == active) {
|
||||
return;
|
||||
@@ -2264,12 +2264,14 @@ void CConnman::SetNetworkActive(bool active)
|
||||
uiInterface.NotifyNetworkActiveChanged(fNetworkActive);
|
||||
}
|
||||
|
||||
CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In) : nSeed0(nSeed0In), nSeed1(nSeed1In)
|
||||
CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In, bool network_active)
|
||||
: nSeed0(nSeed0In), nSeed1(nSeed1In)
|
||||
{
|
||||
SetTryNewOutboundPeer(false);
|
||||
|
||||
Options connOptions;
|
||||
Init(connOptions);
|
||||
SetNetworkActive(network_active);
|
||||
}
|
||||
|
||||
NodeId CConnman::GetNewNodeId()
|
||||
|
||||
Reference in New Issue
Block a user