From a3cd459e6b4935f4b73b365af3498e4b9dc3b98f Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 29 Aug 2019 15:43:50 +0200 Subject: [PATCH] checkpoint JavaScript VM --- src/app/tabs/runTab/model/settings.js | 7 +++++++ src/app/udapp/run-tab.js | 1 + 2 files changed, 8 insertions(+) diff --git a/src/app/tabs/runTab/model/settings.js b/src/app/tabs/runTab/model/settings.js index d7e6ae6f0a..2a2cc31fe7 100644 --- a/src/app/tabs/runTab/model/settings.js +++ b/src/app/tabs/runTab/model/settings.js @@ -10,6 +10,13 @@ class Settings { constructor (udapp) { this.udapp = udapp this.event = new EventManager() + this.commits = 0 + + this.udapp.event.register('initiatingTransaction', (error, from, to, data, lookupOnly, txResult) => { + if (error) console.log(error) + executionContext.checkpointAndCommit(() => console.log('checkpoint on VM', this.commits), this.commits) + this.commits++ + }) this.udapp.event.register('transactionExecuted', (error, from, to, data, lookupOnly, txResult) => { this.event.trigger('transactionExecuted', [error, from, to, data, lookupOnly, txResult]) diff --git a/src/app/udapp/run-tab.js b/src/app/udapp/run-tab.js index 645afc3b4e..ed74ee70c7 100644 --- a/src/app/udapp/run-tab.js +++ b/src/app/udapp/run-tab.js @@ -202,6 +202,7 @@ export class RunTab extends LibraryPlugin { executionContext.init(this.config) executionContext.stopListenOnLastBlock() executionContext.listenOnLastBlock() + executionContext.checkpointAndCommit(() => console.log('checkpoint on VM'), 0) this.udapp.resetEnvironment() this.renderInstanceContainer() this.renderSettings(this.udapp)