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)
747
747
+ HelpExampleRpc (" getblockheader" , " \" 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" " )
748
748
);
749
749
750
- LOCK (cs_main);
751
-
752
750
uint256 hash (ParseHashV (request.params [0 ], " hash" ));
753
751
754
752
bool fVerbose = true ;
755
753
if (!request.params [1 ].isNull ())
756
754
fVerbose = request.params [1 ].get_bool ();
757
755
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
+
759
764
if (!pblockindex) {
760
765
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Block not found" );
761
766
}
@@ -768,7 +773,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
768
773
return strHex;
769
774
}
770
775
771
- return blockheaderToJSON (chainActive. Tip () , pblockindex);
776
+ return blockheaderToJSON (tip , pblockindex);
772
777
}
773
778
774
779
static CBlock GetBlockChecked (const CBlockIndex* pblockindex)
You can’t perform that action at this time.
0 commit comments