Skip to content

Commit

Permalink
should assert dvm block hash
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Aug 21, 2023
1 parent a1b5aac commit 8730ba5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/masternodes/rpc_evm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<VMDomainRPCMapType>(typeInt);
Expand Down

0 comments on commit 8730ba5

Please sign in to comment.