Treap transactions to address 0x0 as contract creation

This commit is contained in:
Leonid Logvinov 2018-03-12 06:07:01 +01:00
parent 9b8d2ed469
commit 2a9913b8fb
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4

View File

@ -72,7 +72,8 @@ export class CoverageSubprovider extends Subprovider {
await this._lock.acquire(); await this._lock.acquire();
} }
if (_.isNull(err)) { 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 { } else {
const payload = { const payload = {
method: 'eth_getBlockByNumber', method: 'eth_getBlockByNumber',
@ -81,11 +82,8 @@ export class CoverageSubprovider extends Subprovider {
const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const jsonRPCResponsePayload = await this.emitPayloadAsync(payload);
const transactions = jsonRPCResponsePayload.result.transactions; const transactions = jsonRPCResponsePayload.result.transactions;
for (const transaction of transactions) { for (const transaction of transactions) {
await this._recordTxTraceAsync( const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to;
transaction.to || constants.NEW_CONTRACT, await this._recordTxTraceAsync(toAddress, transaction.data, transaction.hash);
transaction.data,
transaction.hash,
);
} }
} }
if (!txData.isFakeTransaction) { if (!txData.isFakeTransaction) {