mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
rpc: Fix race in loadtxoutset
The tip may have advanced, also if it did not, there is no reason to have two variables point to the same block.
This commit is contained in:
parent
c818607ed5
commit
fa9108941f
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue