aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-08-09 16:20:00 -0400
committerAva Chow <github@achow101.com>2024-08-09 16:20:00 -0400
commit9a696397e736e109ba0de213967431e2bb9f4102 (patch)
tree68cae28d960f06c1efcaa4ba5c86ec804d6d004e /src/rpc
parent389cf32aca0be6c4b01151c92cc3be79c120f197 (diff)
parent00618e8745192d209c23e3ae873c077e58168957 (diff)
downloadbitcoin-9a696397e736e109ba0de213967431e2bb9f4102.tar.xz
Merge bitcoin/bitcoin#30598: assumeutxo: Drop block height from metadata
00618e8745192d209c23e3ae873c077e58168957 assumeutxo: Drop block height from metadata (Fabian Jahr) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/30514 which has more context and shows how the issue can be reproduced. Since the value in question is removed, there is no test to add to reproduce anything. This is an alternative approach to #30516 with much of the [code being suggested there](https://github.com/bitcoin/bitcoin/pull/30516#discussion_r1689146902). ACKs for top commit: maflcko: re-ACK 00618e8745192d209c23e3ae873c077e58168957 🎌 achow101: ACK 00618e8745192d209c23e3ae873c077e58168957 theStack: Code-review ACK 00618e8745192d209c23e3ae873c077e58168957 ismaelsadeeq: Re-ACK 00618e8745192d209c23e3ae873c077e58168957 mzumsande: ACK 00618e8745192d209c23e3ae873c077e58168957 Tree-SHA512: db9575247bae838ad7742a27a216faaf55bb11e022f9afdd05752bb09bbf9614717d0ad64304ff5722a16bf41d8dea888af544e4ae26dcaa528c1add0269a4a8
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 02f9ecef34..9162defcf5 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2741,7 +2741,7 @@ UniValue CreateUTXOSnapshot(
tip->nHeight, tip->GetBlockHash().ToString(),
fs::PathToString(path), fs::PathToString(temppath)));
- SnapshotMetadata metadata{chainstate.m_chainman.GetParams().MessageStart(), tip->GetBlockHash(), tip->nHeight, maybe_stats->coins_count};
+ SnapshotMetadata metadata{chainstate.m_chainman.GetParams().MessageStart(), tip->GetBlockHash(), maybe_stats->coins_count};
afile << metadata;
@@ -2865,10 +2865,12 @@ static RPCHelpMan loadtxoutset()
throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string()));
}
+ CBlockIndex& snapshot_index{*CHECK_NONFATAL(*activation_result)};
+
UniValue result(UniValue::VOBJ);
result.pushKV("coins_loaded", metadata.m_coins_count);
- result.pushKV("tip_hash", metadata.m_base_blockhash.ToString());
- result.pushKV("base_height", metadata.m_base_blockheight);
+ result.pushKV("tip_hash", snapshot_index.GetBlockHash().ToString());
+ result.pushKV("base_height", snapshot_index.nHeight);
result.pushKV("path", fs::PathToString(path));
return result;
},