Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

[web3-wrapper] Only unmarshall receipt if blockNumber present #1308

Merged
merged 1 commit into from
Nov 26, 2018
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
9 changes: 9 additions & 0 deletions packages/web3-wrapper/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "3.1.6",
"changes": [
{
"note": "Unmarshall mined transaction receipts",
"pr": 1308
}
]
},
{
"version": "3.1.5",
"changes": [
Expand Down
7 changes: 5 additions & 2 deletions packages/web3-wrapper/src/web3_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ export class Web3Wrapper {
method: 'eth_getTransactionReceipt',
params: [txHash],
});
if (!_.isNull(transactionReceiptRpc)) {
// HACK Parity can return a pending transaction receipt. We check for a non null
// block number before continuing with returning a fully realised receipt.
// ref: https://github.com/paritytech/parity-ethereum/issues/1180
if (!_.isNull(transactionReceiptRpc) && !_.isNull(transactionReceiptRpc.blockNumber)) {
transactionReceiptRpc.status = Web3Wrapper._normalizeTxReceiptStatus(transactionReceiptRpc.status);
const transactionReceipt = marshaller.unmarshalTransactionReceipt(transactionReceiptRpc);
return transactionReceipt;
Expand Down Expand Up @@ -577,7 +580,7 @@ export class Web3Wrapper {
}
// Immediately check if the transaction has already been mined.
let transactionReceipt = await this.getTransactionReceiptIfExistsAsync(txHash);
if (!_.isUndefined(transactionReceipt) && !_.isNull(transactionReceipt.blockNumber)) {
if (!_.isUndefined(transactionReceipt)) {
const logsWithDecodedArgs = _.map(
transactionReceipt.logs,
this.abiDecoder.tryToDecodeLogOrNoop.bind(this.abiDecoder),
Expand Down