mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge bitcoin/bitcoin#26395: rpc: add missing lock around chainman.ActiveTip()
f5ff3d773c
rpc: add missing lock around chainman.ActiveTip() (Andrew Toth) Pull request description: https://github.com/bitcoin/bitcoin/pull/23927 seems to have missed a lock around `chainman.ActiveChain()`. ACKs for top commit: aureleoules: ACKf5ff3d773c
Tree-SHA512: 3f116ca44c1b2bc0c7042698249ea3417dfb7c0bb81158a7ceecd087f1e02baa89948f9bb7924b1757798a1691a7de6e886aa72a0a9e227c13a3f512cc59d6c9
This commit is contained in:
commit
ec92d23fb8
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue