Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #56 from nervosnetwork/fix-null-tx
Browse files Browse the repository at this point in the history
fix: Process null tx with status
  • Loading branch information
classicalliu authored Aug 20, 2021
2 parents 8ebcfd9 + 47cf645 commit 5ecf488
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/api-server/src/methods/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ export class Eth {

// if null, find pending transactions
const godwokenTxWithStatus = await this.rpc.getTransaction(txHash);
if (godwokenTxWithStatus == null) {
return null;
}
const godwokenTxReceipt = await this.rpc.getTransactionReceipt(txHash);
const tipBlock = await this.query.getTipBlock();
if (tipBlock == null) {
Expand Down Expand Up @@ -653,6 +656,9 @@ export class Eth {
}

const godwokenTxWithStatus = await this.rpc.getTransaction(txHash);
if (godwokenTxWithStatus == null) {
return null;
}
const godwokenTxReceipt = await this.rpc.getTransactionReceipt(txHash);
if (godwokenTxReceipt == null) {
return null;
Expand Down
4 changes: 3 additions & 1 deletion packages/godwoken/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export class GodwokenClient {
return await this.rpcCall("submit_l2transaction", data);
}

public async getTransaction(hash: Hash): Promise<L2TransactionWithStatus> {
public async getTransaction(
hash: Hash
): Promise<L2TransactionWithStatus | undefined> {
return await this.rpcCall("get_transaction", hash);
}

Expand Down

0 comments on commit 5ecf488

Please sign in to comment.