Skip to content

Commit

Permalink
Make sure we always re-bootstrap Corda networks after a version update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Apr 20, 2020
1 parent 10c7724 commit 5300ad0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"redux-logger": "^2.7.4",
"redux-thunk": "^2.3.0",
"safe-buffer": "^5.0.1",
"semver-parser": "3.0.4",
"shebang-loader": "^0.0.1",
"source-map-support": "^0.5.13",
"truffle": "5.1.20",
Expand Down
8 changes: 7 additions & 1 deletion src/integrations/corda/main/utils/network/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const fetch = require("node-fetch");
const GetPort = require("get-port");
const chokidar = require('chokidar');
const BlobInspector = require("./blob-inspector");
const { compareSemVer } = require("semver-parser");
const { version: APP_VERSION } = require("../../../../../../package.json");
const { REFRESH_CORDAPP, sendRefreshCordapp } = require("../../../../../common/redux/corda-core/actions");
const { SSH_DATA, CLEAR_TERM } = require("../../../../../common/redux/cordashell/actions");
const CORDAPP_DELAY = 1000;
Expand Down Expand Up @@ -94,9 +96,13 @@ class NetworkManager extends EventEmitter {
this._io.sendProgress("Starting PostgreSQL...");
this.pg = await pgDownload.start(postgresPort, chainDataDir, this.entities);
if (this.cancelled) return;
if (this.settings.runBootstrap) {
// assume v2.3.1 if no settings were set
const settingsVersion = this.settings.version || "2.3.1";
const settingsAreOld = compareSemVer(settingsVersion, APP_VERSION) < 0;
if (this.settings.runBootstrap || settingsAreOld) {
this._io.sendProgress("Bootstrapping network...");
await cordaBootstrap.bootstrap(this.config);
this.settings.version = APP_VERSION;
this.settings.runBootstrap = this.settings.name === "Quickstart";
} else {
this._io.sendProgress("Skipping; network already bootstrapped.", 250);
Expand Down

0 comments on commit 5300ad0

Please sign in to comment.