Skip to content

Commit

Permalink
add namespacing to migrate flag (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
chikeichan authored Oct 22, 2021
1 parent 1cfe8e9 commit e7ee43b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/background/node/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ export class NodeService extends EventEmitter {
await this.hsd.connect();
await this.hsd.startSync();

if (!(await get('hsd-3.0.0-migrate'))) {
await put('hsd-3.0.0-migrate', true);
const migrateFlag = `${this.networkName}-hsd-3.0.0-migrate${spv ? '-spv' : ''}`;

if (!(await get(migrateFlag))) {
await put(migrateFlag, true);
}

this.hsd.on('connect', async () => this.refreshNodeInfo());
Expand Down
20 changes: 18 additions & 2 deletions app/components/SplashScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import BobLogo from '../../assets/images/bob-logo-circle.svg';
import Spinner from '../../assets/images/brick-loader.svg';
import dbClient from "../../utils/dbClient";
import Alert from "../Alert";
import {withRouter} from "react-router-dom";
import {connect} from "react-redux";

export default class SplashScreen extends Component {

class SplashScreen extends Component {
static propTypes = {
error: Proptype.string,
network: Proptype.string,
spv: Proptype.bool,
};

static defaultProps = {
Expand All @@ -19,7 +24,9 @@ export default class SplashScreen extends Component {
};

async componentWillMount() {
const hasMigrated300 = await dbClient.get('hsd-3.0.0-migrate');
const {network, spv} = this.props;
const migrateFlag = `${network}-hsd-3.0.0-migrate${spv ? '-spv' : ''}`;
const hasMigrated300 = await dbClient.get(migrateFlag);
this.setState({ hasMigrated300 });
}

Expand Down Expand Up @@ -61,6 +68,15 @@ export default class SplashScreen extends Component {
}
}

export default withRouter(
connect(
(state) => ({
network: state.node.network,
spv: state.node.spv,
}),
)(SplashScreen)
);

const wrapperStyle = {
display: 'flex',
flexFlow: 'column nowrap',
Expand Down

0 comments on commit e7ee43b

Please sign in to comment.