Skip to content

Commit 140c1cb

Browse files
committed
partially revert 668d00d
1 parent 668d00d commit 140c1cb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/rpc/quorums.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)