deth
Version:
Ethereum node focused on Developer Experience
19 lines (18 loc) • 610 B
JavaScript
import { getNextBlock } from './getNextBlock';
export async function runIsolatedTransaction(vm, transaction, options, clockSkew) {
const psm = vm.pStateManager;
const initialStateRoot = await psm.getStateRoot();
try {
const block = await getNextBlock(vm, [transaction], options, clockSkew);
const result = await vm.runTx({
block,
tx: transaction,
skipNonce: options.skipNonceCheck,
skipBalance: options.skipBalanceCheck,
});
return result;
}
finally {
await psm.setStateRoot(initialStateRoot);
}
}