Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add namespacing to migrate flag #418

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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