Skip to content

Commit 598b9bb

Browse files
committed
rpc: Don't re-enable previously disabled network after dumptxoutset
Also fixes a typo in the RPC help text.
1 parent d4b5553 commit 598b9bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/rpc/blockchain.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,7 @@ static RPCHelpMan dumptxoutset()
26982698
"This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)",
26992699
{
27002700
{"path", RPCArg::Type::STR, RPCArg::Optional::NO, "Path to the output file. If relative, will be prefixed by datadir."},
2701-
{"type", RPCArg::Type::STR, RPCArg::Default(""), "The type of snapshot to create. Can be \"latest\" to create a snapshot of the current UTXO set or \"rollback\" to temporarily roll back the state of the node to a historical block before creating the snapshot of a historical UTXO set. This parameter can be omitted if a separate \"rollback\" named parameter is specified indicating the height or hash of a specific historical block. If \"rollback\" is specified and separate \"rollback\" named parameter is not specified, this will roll back to the latest valid snapshot block that currently be loaded with loadtxoutset."},
2701+
{"type", RPCArg::Type::STR, RPCArg::Default(""), "The type of snapshot to create. Can be \"latest\" to create a snapshot of the current UTXO set or \"rollback\" to temporarily roll back the state of the node to a historical block before creating the snapshot of a historical UTXO set. This parameter can be omitted if a separate \"rollback\" named parameter is specified indicating the height or hash of a specific historical block. If \"rollback\" is specified and separate \"rollback\" named parameter is not specified, this will roll back to the latest valid snapshot block that can currently be loaded with loadtxoutset."},
27022702
{"options", RPCArg::Type::OBJ_NAMED_PARAMS, RPCArg::Optional::OMITTED, "",
27032703
{
27042704
{"rollback", RPCArg::Type::NUM, RPCArg::Optional::OMITTED,
@@ -2790,7 +2790,12 @@ static RPCHelpMan dumptxoutset()
27902790
// this so we don't punish peers that send us that send us data that
27912791
// seems wrong in this temporary state. For example a normal new block
27922792
// would be classified as a block connecting an invalid block.
2793-
disable_network = std::make_unique<NetworkDisable>(connman);
2793+
// Skip if the network is already disabled because this
2794+
// automatically re-enables the network activity at the end of the
2795+
// process which may not be what the user wants.
2796+
if (connman.GetNetworkActive()) {
2797+
disable_network = std::make_unique<NetworkDisable>(connman);
2798+
}
27942799

27952800
invalidate_index = WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Next(target_index));
27962801
InvalidateBlock(*node.chainman, invalidate_index->GetBlockHash());

0 commit comments

Comments
 (0)