aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-09 04:08:13 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-09 05:56:45 +0800
commitb6c8d8e9712eafd7e93f061ea41fb47dc1ca2788 (patch)
treeda283421db5db8a77e88f12b96dedefcc726a778
parentab94b0b23133dfb61b763982718700f04e7e1e3a (diff)
downloaddexon-sol-tools-b6c8d8e9712eafd7e93f061ea41fb47dc1ca2788.tar.gz
dexon-sol-tools-b6c8d8e9712eafd7e93f061ea41fb47dc1ca2788.tar.zst
dexon-sol-tools-b6c8d8e9712eafd7e93f061ea41fb47dc1ca2788.zip
Await fake transactions
-rw-r--r--packages/sol-cov/src/trace_collection_subprovider.ts8
1 files changed, 4 insertions, 4 deletions
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.
}