mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-05-17 23:56:39 +00:00
rpc: add missing lock around chainman.ActiveTip()
This commit is contained in:
parent
88502ecf08
commit
f5ff3d773c
@ -461,7 +461,7 @@ static RPCHelpMan getblockfrompeer()
|
||||
|
||||
// Fetching blocks before the node has syncing past their height can prevent block files from
|
||||
// being pruned, so we avoid it if the node is in prune mode.
|
||||
if (index->nHeight > chainman.ActiveChain().Tip()->nHeight && node::fPruneMode) {
|
||||
if (node::fPruneMode && index->nHeight > WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip()->nHeight)) {
|
||||
throw JSONRPCError(RPC_MISC_ERROR, "In prune mode, only blocks that the node has already synced previously can be fetched from a peer");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user