File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -886,18 +886,26 @@ static UniValue verifychainlock(const JSONRPCRequest& request)
886886 } else {
887887 nBlockHeight = ParseInt32V (request.params [2 ], " blockHeight" );
888888 LOCK (cs_main);
889- if (nBlockHeight < 0 || nBlockHeight > :: ChainActive (). Height () ) {
889+ if (nBlockHeight < 0 ) {
890890 throw JSONRPCError (RPC_INVALID_PARAMETER, " Block height out of range" );
891891 }
892- pIndex = ::ChainActive ()[nBlockHeight];
892+ if (nBlockHeight <= ::ChainActive ().Height ()) {
893+ pIndex = ::ChainActive ()[nBlockHeight];
894+ }
893895 }
894896
895- CHECK_NONFATAL (pIndex != nullptr );
896-
897897 CBLSSignature sig;
898- bool use_legacy_signature = !llmq::utils::IsV19Active (pIndex);
899- if (!sig.SetHexStr (request.params [1 ].get_str (), use_legacy_signature)) {
900- throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid signature format" );
898+ if (pIndex) {
899+ bool use_legacy_signature = !llmq::utils::IsV19Active (pIndex);
900+ if (!sig.SetHexStr (request.params [1 ].get_str (), use_legacy_signature)) {
901+ throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid signature format" );
902+ }
903+ } else {
904+ if (!sig.SetHexStr (request.params [1 ].get_str (), false ) &&
905+ !sig.SetHexStr (request.params [1 ].get_str (), true )
906+ ) {
907+ throw JSONRPCError (RPC_INVALID_PARAMETER, " invalid signature format" );
908+ }
901909 }
902910
903911 LLMQContext& llmq_ctx = EnsureLLMQContext (request.context );
You can’t perform that action at this time.
0 commit comments