rpc: Don't re-enable previously disabled network after dumptxoutset

Also fixes a typo in the RPC help text.
pull/30808/head
Fabian Jahr 2 months ago
parent d4b5553849
commit 598b9bba5a
No known key found for this signature in database
GPG Key ID: F13D1E9D890798CD

@ -2698,7 +2698,7 @@ static RPCHelpMan dumptxoutset()
"This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)",
{
{"path", RPCArg::Type::STR, RPCArg::Optional::NO, "Path to the output file. If relative, will be prefixed by datadir."},
{"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."},
{"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."},
{"options", RPCArg::Type::OBJ_NAMED_PARAMS, RPCArg::Optional::OMITTED, "",
{
{"rollback", RPCArg::Type::NUM, RPCArg::Optional::OMITTED,
@ -2790,7 +2790,12 @@ static RPCHelpMan dumptxoutset()
// this so we don't punish peers that send us that send us data that
// seems wrong in this temporary state. For example a normal new block
// would be classified as a block connecting an invalid block.
disable_network = std::make_unique<NetworkDisable>(connman);
// Skip if the network is already disabled because this
// automatically re-enables the network activity at the end of the
// process which may not be what the user wants.
if (connman.GetNetworkActive()) {
disable_network = std::make_unique<NetworkDisable>(connman);
}
invalidate_index = WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Next(target_index));
InvalidateBlock(*node.chainman, invalidate_index->GetBlockHash());

Loading…
Cancel
Save