From 752c8b286a69aeed02956735990a73991c39c920 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Mon, 23 Oct 2023 12:40:29 -0400 Subject: [PATCH 1/4] Merge bitcoin/bitcoin#28618: doc: assumeutxo prune and index notes 03f82087f6ce1c29327f34d12945200494e6956d doc: assumeutxo prune and index notes (Sjors Provoost) Pull request description: Based on recent comments on #27596. ACKs for top commit: pablomartin4btc: re ACK 03f82087f6ce1c29327f34d12945200494e6956d ryanofsky: ACK 03f82087f6ce1c29327f34d12945200494e6956d. Nice changes, these seem like very helpful notes Tree-SHA512: fe651b49f4d667400a3655899f27a96dd1eaf67cf9215fb35db5f44fb8c0313e7d541518be6791fec93392df24b909793f3886adb808e53228ed2a291165639d --- doc/design/assumeutxo.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/design/assumeutxo.md b/doc/design/assumeutxo.md index 667b3deda0b5..8900ce3f5c09 100644 --- a/doc/design/assumeutxo.md +++ b/doc/design/assumeutxo.md @@ -3,8 +3,44 @@ Assumeutxo is a feature that allows fast bootstrapping of a validating dashd instance with a very similar security model to assumevalid. -The RPC commands `dumptxoutset` and `loadtxoutset` are used to respectively generate -and load UTXO snapshots. The utility script `./contrib/devtools/utxo_snapshot.sh` may +## Loading a snapshot + +There is currently no canonical source for snapshots, but any downloaded snapshot +will be checked against a hash that's been hardcoded in source code. + +Once you've obtained the snapshot, you can use the RPC command `loadtxoutset` to +load it. + +### Pruning + +A pruned node can load a snapshot. To save space, it's possible to delete the +snapshot file as soon as `loadtxoutset` finishes. + +The minimum `-dbcache` setting is 550 MiB, but this functionality ignores that +minimum and uses at least 1100 MiB. + +As the background sync continues there will be temporarily two chainstate +directories, each multiple gigabytes in size (likely growing larger than the +the downloaded snapshot). + +### Indexes + +Indexes work but don't take advantage of this feature. They always start building +from the genesis block. Once the background validation reaches the snapshot block, +indexes will continue to build all the way to the tip. + +For indexes that support pruning, note that no pruning will take place between +the snapshot and the tip, until the background sync has completed - after which +everything is pruned. Depending on how old the snapshot is, this may temporarily +use a significant amount of disk space. + +## Generating a snapshot + +The RPC command `dumptxoutset` can be used to generate a snapshot. This can be used +to create a snapshot on one node that you wish to load on another node. +It can also be used to verify the hardcoded snapshot hash in the source code. + +The utility scriptt `./contrib/devtools/utxo_snapshot.sh` may be of use. ## General background From c4ae99fec8fc390a05f7e10697ab1bfce8201a88 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 13 Oct 2023 11:07:25 +0200 Subject: [PATCH 2/4] Merge bitcoin/bitcoin#28639: refactor: Remove unused nchaintx from SnapshotMetadata constructor, fix test, add test fafde92f84fb7c245bc3c1cd946a32c891861e5e test: Check snapshot file with wrong number of coins (MarcoFalke) faa90f6e7b6b8c531e1ae142a5c2f568b48502a9 refactor: Remove unused nchaintx from SnapshotMetadata constructor (MarcoFalke) Pull request description: See commit messages ACKs for top commit: Sjors: utACK fafde92f84fb7c245bc3c1cd946a32c891861e5e theStack: ACK fafde92f84fb7c245bc3c1cd946a32c891861e5e Tree-SHA512: 9ed2720b50d1c0938f30543ba143e1a4c6af3a0ff166f8b3eb452e1d99ddee6e3443a4c99f77efe94b8c3eb2feff984bf5259807ee8085e1e0e1e0d1de98227e --- src/node/utxo_snapshot.h | 3 +-- src/rpc/blockchain.cpp | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/node/utxo_snapshot.h b/src/node/utxo_snapshot.h index 401d4baaeb92..a58061c90554 100644 --- a/src/node/utxo_snapshot.h +++ b/src/node/utxo_snapshot.h @@ -26,8 +26,7 @@ class SnapshotMetadata SnapshotMetadata() { } SnapshotMetadata( const uint256& base_blockhash, - uint64_t coins_count, - unsigned int nchaintx) : + uint64_t coins_count) : m_base_blockhash(base_blockhash), m_coins_count(coins_count) { } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 203e20da3ba2..ddadb2a083be 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2772,7 +2772,7 @@ UniValue CreateUTXOSnapshot( tip->nHeight, tip->GetBlockHash().ToString(), fs::PathToString(path), fs::PathToString(temppath))); - SnapshotMetadata metadata{tip->GetBlockHash(), maybe_stats->coins_count, tip->nChainTx}; + SnapshotMetadata metadata{tip->GetBlockHash(), maybe_stats->coins_count}; afile << metadata; @@ -2799,9 +2799,7 @@ UniValue CreateUTXOSnapshot( result.pushKV("base_height", tip->nHeight); result.pushKV("path", path.utf8string()); result.pushKV("txoutset_hash", maybe_stats->hashSerialized.ToString()); - // Cast required because univalue doesn't have serialization specified for - // `unsigned int`, nChainTx's type. - result.pushKV("nchaintx", uint64_t{tip->nChainTx}); + result.pushKV("nchaintx", tip->nChainTx); return result; } From a55c3c15f6e6edde3bd60fd0b5d85bcc7233a1e3 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 22 Aug 2023 10:34:56 +0100 Subject: [PATCH 3/4] Merge bitcoin/bitcoin#28320: test: Support riscv64 in get_previous_releases.py 2222e15771838ffcb68adb0f825ce488dce5cab2 test: Support riscv64 in get_previous_releases.py (MarcoFalke) Pull request description: To test: `test/get_previous_releases.py -b -t /tmp/prev_releases v0.18.1` On master: `Not sure which binary to download for riscv64-unknown-linux-gnu` Here: (pass) ACKs for top commit: fanquake: ACK 2222e15771838ffcb68adb0f825ce488dce5cab2 Tree-SHA512: 18dc9a6c65f78adb5f7fc09e57db34c6b544071cb7bb3fa2846c86a23202e37d6ea1c5aca9acc1c2040b7d2b97bb93840a8a949f81f71fe6f01c395d2894739d --- test/get_previous_releases.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/get_previous_releases.py b/test/get_previous_releases.py index e900c5baeb29..2ab93d15fc45 100755 --- a/test/get_previous_releases.py +++ b/test/get_previous_releases.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (c) 2018-2020 The Bitcoin Core developers +# Copyright (c) 2018-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # @@ -272,6 +272,7 @@ def check_host(args) -> int: if args.download_binary: platforms = { 'aarch64-*-linux*': 'aarch64-linux-gnu', + 'riscv64-*-linux*': 'riscv64-linux-gnu', 'x86_64-*-linux*': 'x86_64-linux-gnu', 'x86_64-apple-darwin*': 'x86_64-apple-darwin', 'aarch64-apple-darwin*': 'arm64-apple-darwin', From fea4e9939551a4d912458475947917fadc118396 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 23 Aug 2023 16:27:27 -0400 Subject: [PATCH 4/4] Merge bitcoin/bitcoin#27829: rpc: fix data optionality for RPC calls. 27b168b81f3959f5376a4176673187a71c7b25e1 Update help text for spend and rawtransaction rpcs (Michael Tidwell) Pull request description: The "data" field without outputs was marked as "required" in the help docs when using bitcoin-cli. This field when left off worked as an intended optional OP_RETURN. closes #27828. Motivation: It is hard to understand that "data" is actually optional for commands like `createpsbt` and `walletcreatefundedpsbt`. ACKs for top commit: achow101: ACK 27b168b81f3959f5376a4176673187a71c7b25e1 Sjors: tACK 27b168b81f3959f5376a4176673187a71c7b25e1 Tree-SHA512: 235e7ed4af69880880c04015b3f7de72c8f31ae035485c4c64c483e282948f3ea3f1eef16f15e260a1aaf21114150713516ba6a99967ccad9ecd91ff67cb0450 --- src/rpc/rawtransaction.cpp | 5 +++-- src/wallet/rpc/spend.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 5db203c01832..1bb011243696 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -198,8 +198,9 @@ static std::vector CreateTxDoc() }, }, }, - {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n" - "That is, each address can only appear once and there can only be one 'data' object.\n" + {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs specified as key-value pairs.\n" + "Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.\n" + "At least one output of either type must be specified.\n" "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" " accepted as second parameter.", { diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 17a592c8302f..560d9509ac57 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -803,8 +803,9 @@ RPCHelpMan send() "\nEXPERIMENTAL warning: this call may be changed in future releases.\n" "\nSend a transaction.\n", { - {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n" - "That is, each address can only appear once and there can only be one 'data' object.\n" + {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs specified as key-value pairs.\n" + "Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.\n" + "At least one output of either type must be specified.\n" "For convenience, a dictionary, which holds the key-value pairs directly, is also accepted.", { {"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "", @@ -1097,8 +1098,9 @@ RPCHelpMan walletcreatefundedpsbt() }, }, }, - {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n" - "That is, each address can only appear once and there can only be one 'data' object.\n" + {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs specified as key-value pairs.\n" + "Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.\n" + "At least one output of either type must be specified.\n" "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" "accepted as second parameter.", {