From 2a9913b8fbcc4911593eab0ecdec3b62328e0b31 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Mar 2018 06:07:01 +0100 Subject: Treap transactions to address 0x0 as contract creation --- packages/sol-cov/src/coverage_subprovider.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index e391b0f5c..ba7552fe6 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -72,7 +72,8 @@ export class CoverageSubprovider extends Subprovider { await this._lock.acquire(); } if (_.isNull(err)) { - await this._recordTxTraceAsync(txData.to || constants.NEW_CONTRACT, txData.data, txHash as string); + const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to; + await this._recordTxTraceAsync(toAddress, txData.data, txHash as string); } else { const payload = { method: 'eth_getBlockByNumber', @@ -81,11 +82,8 @@ export class CoverageSubprovider extends Subprovider { const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const transactions = jsonRPCResponsePayload.result.transactions; for (const transaction of transactions) { - await this._recordTxTraceAsync( - transaction.to || constants.NEW_CONTRACT, - transaction.data, - transaction.hash, - ); + const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to; + await this._recordTxTraceAsync(toAddress, transaction.data, transaction.hash); } } if (!txData.isFakeTransaction) { -- cgit v1.2.3