rpc: add missing lock around chainman.ActiveTip()
This commit is contained in:
1 parent
88502ecf08
commit
f5ff3d773c
1 file changed
+1
-1
@@ -461,7 +461,7 @@ static RPCHelpMan getblockfrompeer()
|
|||||||
|
|
||||||
// Fetching blocks before the node has syncing past their height can prevent block files from
|
// 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.
|
// 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");
|
throw JSONRPCError(RPC_MISC_ERROR, "In prune mode, only blocks that the node has already synced previously can be fetched from a peer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user