From 8730ba5c4460164caf94412e9ef9edd87718d810 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Mon, 21 Aug 2023 17:29:12 +0800 Subject: [PATCH] should assert dvm block hash --- src/masternodes/rpc_evm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/masternodes/rpc_evm.cpp b/src/masternodes/rpc_evm.cpp index 42c736b2bb8..0757a07c55f 100644 --- a/src/masternodes/rpc_evm.cpp +++ b/src/masternodes/rpc_evm.cpp @@ -242,7 +242,7 @@ UniValue vmmap(const JSONRPCRequest &request) { }; auto tryResolveBlockNumberType = - [](const std::string input) { + [&throwUnsupportedAuto](const std::string input) { uint64_t height; if (!ParseUInt64(input, &height)) { return VMDomainRPCMapType::Unknown; @@ -254,7 +254,13 @@ UniValue vmmap(const JSONRPCRequest &request) { return VMDomainRPCMapType::BlockNumberEVMToDVM; } - return VMDomainRPCMapType::BlockNumberDVMToEVM; + CBlockIndex* dvmBlock = ::ChainActive()[height]; + if (dvmBlock != nullptr) { + return VMDomainRPCMapType::BlockNumberDVMToEVM; + } + + throwUnsupportedAuto(); + return VMDomainRPCMapType::Unknown; }; auto type = static_cast(typeInt);