Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix evm tx hash and add test case #2078

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3878,7 +3878,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor {
std::vector<unsigned char> evmTxHashBytes;
sha3(obj.evmTx, evmTxHashBytes);
auto txHash = tx.GetHash();
auto evmTxHash = uint256(evmTxHashBytes);
auto evmTxHash = uint256S(HexStr(evmTxHashBytes));
mnview.SetVMDomainMapTxHash(VMDomainMapType::DVMToEVM, txHash, evmTxHash);
mnview.SetVMDomainMapTxHash(VMDomainMapType::EVMToDVM, evmTxHash, txHash);
return Res::Ok();
Expand Down
3 changes: 2 additions & 1 deletion test/functional/feature_evm_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ def test_vmmap(self):
assert_raises_rpc_error(-5, "0x0000000000000000000000000000000000000000 does not refer to a key", self.nodes[0].vmmap, eth_address, 2)
assert_raises_rpc_error(-5, "Invalid address: test", self.nodes[0].vmmap, 'test', 1)

#Check if xvmmap is working for Txs
# Check if xvmmap is working for Txs
list_tx = self.nodes[0].logvmmaps(1)
dvm_tx = list(list_tx['indexes'].keys())[0]
evm_tx = self.nodes[0].vmmap(dvm_tx, 3)
assert_equal(dvm_tx, self.nodes[0].vmmap(evm_tx, 4))
assert_equal("0x" + evm_tx, self.nodes[0].eth_getBlockByNumber("latest", False)['transactions'][0])

# Check vmmap fail on wrong tx
evm_tx = '0x0000000000000000000000000000000000000000000000000000000000000000'
Expand Down