From b6c8d8e9712eafd7e93f061ea41fb47dc1ca2788 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 8 Jun 2018 13:08:13 -0700 Subject: Await fake transactions --- packages/sol-cov/src/trace_collection_subprovider.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/sol-cov/src') diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 7b7ada535..ffa33ad41 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -219,7 +219,6 @@ export class TraceCollectionSubprovider extends Subprovider { // transaction execution for all transactions except our fake ones. await this._lock.acquire(); const blockchainLifecycle = new BlockchainLifecycle(this._web3Wrapper); - // debugPrinter.enterFunction('snapshot'); await blockchainLifecycle.startAsync(); const fakeTxData: MaybeFakeTxData = { isFakeTransaction: true, // This transaction (and only it) is allowed to come through when the lock is locked @@ -227,11 +226,11 @@ export class TraceCollectionSubprovider extends Subprovider { from: callData.from || this._defaultFromAddress, }; try { - await this._web3Wrapper.sendTransactionAsync(fakeTxData); + const txHash = await this._web3Wrapper.sendTransactionAsync(fakeTxData); + await this._web3Wrapper.awaitTransactionMinedAsync(txHash); } catch (err) { // Even if this transaction failed - we've already recorded it's trace. } - // debugPrinter.leaveFunction('snapshot'); await blockchainLifecycle.revertAsync(); this._lock.release(); } @@ -248,7 +247,8 @@ export class TraceCollectionSubprovider extends Subprovider { gas: BLOCK_GAS_LIMIT, }; try { - await this._web3Wrapper.sendTransactionAsync(fakeTxData); + const txHash = await this._web3Wrapper.sendTransactionAsync(fakeTxData); + await this._web3Wrapper.awaitTransactionMinedAsync(txHash); } catch (err) { // Even if this transaction failed - we've already recorded it's trace. } -- cgit v1.2.3