From 40f4348276b036ee7be945c0586cd603168afa3a Mon Sep 17 00:00:00 2001 From: Bushstar Date: Sun, 26 Nov 2023 12:40:22 +0000 Subject: [PATCH] Use snapshot in getblockcount --- src/rpc/blockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 026580c4a4..ec0c56ecbf 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -424,8 +424,8 @@ static UniValue getblockcount(const JSONRPCRequest& request) }, }.Check(request); - LOCK(cs_main); - return ::ChainActive().Height(); + const auto view = ::GetViewSnapshot(); + return view->GetLastHeight(); } static UniValue getbestblockhash(const JSONRPCRequest& request)