mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 14:18:58 +02:00
Merge bitcoin/bitcoin#29262: rpc: Fix race in loadtxoutset
5555d8db33test: Use blocks_path where possible (MarcoFalke)fa9108941frpc: Fix race in loadtxoutset (MarcoFalke) Pull request description: The tip may have advanced, also if it did not, there is no reason to have two variables point to the same block. Fixes https://github.com/bitcoin/bitcoin/pull/27596#discussion_r1344694600 ACKs for top commit: achow101: ACK5555d8db33pablomartin4btc: ACK5555d8db33BrandonOdiwuor: Code Review ACK5555d8db33Tree-SHA512: 23a82924a915b61bb1adab8ad20ec8914139c8ee647817af34ca27ee310a2e45833d8b285503e0feebe63e4667193d6d98cfcbbc1509bf40712225e04dd19e8b
This commit is contained in:
@@ -2785,12 +2785,11 @@ static RPCHelpMan loadtxoutset()
|
||||
if (!chainman.ActivateSnapshot(afile, metadata, false)) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to load UTXO snapshot " + fs::PathToString(path));
|
||||
}
|
||||
CBlockIndex* new_tip{WITH_LOCK(::cs_main, return chainman.ActiveTip())};
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("coins_loaded", metadata.m_coins_count);
|
||||
result.pushKV("tip_hash", new_tip->GetBlockHash().ToString());
|
||||
result.pushKV("base_height", new_tip->nHeight);
|
||||
result.pushKV("tip_hash", snapshot_start_block->GetBlockHash().ToString());
|
||||
result.pushKV("base_height", snapshot_start_block->nHeight);
|
||||
result.pushKV("path", fs::PathToString(path));
|
||||
return result;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user