UNPKG

deth

Version:

Ethereum node focused on Developer Experience

22 lines (21 loc) 755 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getNextBlock_1 = require("./getNextBlock"); async function runIsolatedTransaction(vm, transaction, options, clockSkew) { const psm = vm.pStateManager; const initialStateRoot = await psm.getStateRoot(); try { const block = await getNextBlock_1.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); } } exports.runIsolatedTransaction = runIsolatedTransaction;