aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2024-03-16 21:36:28 +0100
committerFabian Jahr <fjahr@protonmail.com>2024-09-01 21:07:21 +0200
commite868a6e070a91c00555e72181f9b14bbf0373fdc (patch)
tree4007d1223aced204b9340ddde2f885695cd10340 /src/rpc
parentb29c21fc92dcc3da95bd032ba41675a8b9a0a24b (diff)
downloadbitcoin-e868a6e070a91c00555e72181f9b14bbf0373fdc.tar.xz
doc: Improve assumeutxo guide and add more docs/comments
Also fixes some outdated information in the remaining design doc.
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 4dc7dbfa93..3a2bbeecf3 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2676,7 +2676,10 @@ static RPCHelpMan dumptxoutset()
{
return RPCHelpMan{
"dumptxoutset",
- "Write the serialized UTXO set to a file.",
+ "Write the serialized UTXO set to a file. This can be used in loadtxoutset afterwards if this snapshot height is supported in the chainparams as well.\n\n"
+ "Unless the the \"latest\" type is requested, the node will roll back to the requested height and network activity will be suspended during this process. "
+ "Because of this it is discouraged to interact with the node in any other way during the execution of this call to avoid inconsistent results and race conditions, particularly RPCs that interact with blockstorage.\n\n"
+ "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."},
@@ -2773,6 +2776,8 @@ static RPCHelpMan dumptxoutset()
// would be classified as a block connecting an invalid block.
disable_network = std::make_unique<NetworkDisable>(connman);
+ // Note: Unlocking cs_main before CreateUTXOSnapshot might be racy
+ // if the user interacts with any other *block RPCs.
invalidate_index = WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Next(target_index));
InvalidateBlock(*node.chainman, invalidate_index->GetBlockHash());
const CBlockIndex* new_tip_index{WITH_LOCK(::cs_main, return node.chainman->ActiveChain().Tip())};