Address feedback
This commit is contained in:
parent
799a87f35e
commit
29c1ea39f8
|
@ -112,28 +112,26 @@ class Test {
|
|||
// 3) Once we get the receipt back, we dispatch the real call and pass the original callback;
|
||||
//
|
||||
// This will still allow tests to get the return value from the call and run contracts unmodified.
|
||||
simProvider.realSendAsync = simProvider.sendAsync;
|
||||
simProvider.realSendAsync = simProvider.sendAsync.bind(simProvider);
|
||||
simProvider.sendAsync = function(payload, cb) {
|
||||
if(payload.method !== 'eth_call') {
|
||||
return simProvider.realSendAsync.apply(simProvider.realSendAsync, [payload, cb]);
|
||||
return simProvider.realSendAsync(payload, cb);
|
||||
}
|
||||
|
||||
let newParams = Object.assign({}, payload.params[0], {gasPrice: '0x77359400'});
|
||||
let newPayload = {
|
||||
id: parseInt(Math.random(1000000) * 1000000, 10),
|
||||
id: payload.id + 1,
|
||||
method: 'eth_sendTransaction',
|
||||
params: [newParams],
|
||||
jsonrpc: payload.jsonrpc
|
||||
};
|
||||
|
||||
let txCallback = (_err, response) => {
|
||||
simProvider.realSendAsync(newPayload, (_err, response) => {
|
||||
let txHash = response.result;
|
||||
self.web3.eth.getTransactionReceipt(txHash, (_err, _res) => {
|
||||
simProvider.realSendAsync.apply(simProvider.realSendAsync, [payload, cb]);
|
||||
simProvider.realSendAsync(payload, cb);
|
||||
});
|
||||
};
|
||||
|
||||
simProvider.realSendAsync.apply(simProvider.realSendAsync, [newPayload, txCallback]);
|
||||
});
|
||||
};
|
||||
|
||||
this.web3.setProvider(simProvider);
|
||||
|
|
Loading…
Reference in New Issue