From 03b3b80a657de864f020f605060b0dffd452b482 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 23 Nov 2018 15:20:33 +1100 Subject: bug: Only unmarshall receipt if blockNumber present. https://github.com/paritytech/parity-ethereum/issues/1180 Parity can return a pending transaction receipt with a number of null values --- packages/web3-wrapper/src/web3_wrapper.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'packages/web3-wrapper/src') diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index f1247e48a..76cae4b01 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -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; @@ -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), -- cgit v1.2.3