File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -747,15 +747,20 @@ static UniValue getblockheader(const JSONRPCRequest& request)
747747 + HelpExampleRpc (" getblockheader" , " \" 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" " )
748748 );
749749
750- LOCK (cs_main);
751-
752750 uint256 hash (ParseHashV (request.params [0 ], " hash" ));
753751
754752 bool fVerbose = true ;
755753 if (!request.params [1 ].isNull ())
756754 fVerbose = request.params [1 ].get_bool ();
757755
758- const CBlockIndex* pblockindex = LookupBlockIndex (hash);
756+ const CBlockIndex* pblockindex;
757+ const CBlockIndex* tip;
758+ {
759+ LOCK (cs_main);
760+ pblockindex = LookupBlockIndex (hash);
761+ tip = chainActive.Tip ();
762+ }
763+
759764 if (!pblockindex) {
760765 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Block not found" );
761766 }
@@ -768,7 +773,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
768773 return strHex;
769774 }
770775
771- return blockheaderToJSON (chainActive. Tip () , pblockindex);
776+ return blockheaderToJSON (tip , pblockindex);
772777}
773778
774779static CBlock GetBlockChecked (const CBlockIndex* pblockindex)
You can’t perform that action at this time.
0 commit comments