Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix: hex encode hash in eth_getTransactionReceipt notice #857

Merged
merged 1 commit into from
Mar 9, 2021
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
5 changes: 3 additions & 2 deletions src/chains/ethereum/ethereum/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,8 @@ export default class EthereumApi implements types.Api {
@assertArgLength(1)
async eth_getTransactionReceipt(transactionHash: string) {
const { transactions, transactionReceipts, blocks } = this.#blockchain;
const txHash = Data.from(transactionHash).toBuffer();
const dataHash = Data.from(transactionHash);
const txHash = dataHash.toBuffer();

const transactionPromise = transactions.get(txHash);
const receiptPromise = transactionReceipts.get(txHash);
Expand Down Expand Up @@ -1244,7 +1245,7 @@ export default class EthereumApi implements types.Api {
if (tx != null) {
options.logging.logger.log(
" > Ganache `eth_getTransactionReceipt` notice: the transaction with hash\n" +
` > \`${txHash.toString()}\` has not\n` +
` > \`${dataHash.toString()}\` has not\n` +
davidmurdoch marked this conversation as resolved.
Show resolved Hide resolved
" > yet been mined. See https://trfl.co/v7-instamine for additional information."
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ describe("api", () => {
beforeEach(async () => {
// create a logger to test output
logger = {
clearLoggedStuff: function () {
clearLoggedStuff: function() {
this.loggedStuff = "";
},
loggedStuff: "",
log: function (message) {
log: function(message) {
if (message) {
this.loggedStuff += message;
}
Expand Down Expand Up @@ -75,7 +75,9 @@ describe("api", () => {
assert.strictEqual(result, null);
assert(
logger.loggedStuff.includes(
"Ganache `eth_getTransactionReceipt` notice"
" > Ganache `eth_getTransactionReceipt` notice: the transaction with hash\n" +
` > \`${hash}\` has not\n` +
" > yet been mined. See https://trfl.co/v7-instamine for additional information."
)
);
});
Expand Down