aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/coverage_subprovider.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 13:07:01 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 13:07:01 +0800
commit2a9913b8fbcc4911593eab0ecdec3b62328e0b31 (patch)
treeaa56d0e7ec48b6435c8fb77d319ff0053bed1369 /packages/sol-cov/src/coverage_subprovider.ts
parent9b8d2ed4697d6f5542eafc289dfcf99e9b65139d (diff)
downloaddexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar.gz
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar.bz2
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar.lz
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar.xz
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.tar.zst
dexon-sol-tools-2a9913b8fbcc4911593eab0ecdec3b62328e0b31.zip
Treap transactions to address 0x0 as contract creation
Diffstat (limited to 'packages/sol-cov/src/coverage_subprovider.ts')
-rw-r--r--packages/sol-cov/src/coverage_subprovider.ts10
1 files changed, 4 insertions, 6 deletions
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) {