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

Start the embedded node on test net chain if the active wallet is_testnet is true. #4

Merged
merged 6 commits into from
Sep 21, 2022

Conversation

flomang
Copy link
Collaborator

@flomang flomang commented Sep 12, 2022

I've made the assumption here that there will only ever be one internal embedded node. This node's chain type will be based off of the active wallet's is_testnet flag.

@flomang
Copy link
Collaborator Author

flomang commented Sep 12, 2022

This maybe? Does a previously started node need to be gracefully shutdown?

@yeastplume
Copy link
Member

yeastplume commented Sep 13, 2022

Yes, what you've started here is what I had in mind. Since users will be able to open and close wallets that may have different node settings or swap between mainnet and testnet freely, we'll also need the ability to start and shut down the internal node. Shutting down the server should just be a case of calling server.stop() in the run function of node/mod.rs.

The overall design should look like (again, this is in my head so everything is open to discussion):

  • The gui config file stores an array of all wallets, and each entry defines an instance of a wallet. These 'wallet instances' store their display names, top-level directory that contains the grin_wallet.toml file, the is_testnet flag and the use_embedded_node flag. (I think this is all in place.
  • When the user opens a wallet that has use_embedded_node set, the global chain type flag is set according to the wallet instance's is_testnet flag, and the embedded node is launched. If the embedded node had been launched previously and was a different chain type, it should be stopped and restarted with the new chain type. The embedded node details should then appear in the node tab, and the contents of this tab should eventually be filled out to match the details shown in the current node TUI. At the moment, I think the node is just dumbly started on start up, so this logic needs to be filled out
  • When running the embedded node. The config fields found in the wallet's grin_wallet.toml should be overriden within the gui code to point to the embedded node instance. The embedded node should ideally run on its own uniqueish port separate from the defaults in the command line versions.
  • There will be separate nodes stored in the gui data directories, mainnet node data will be at ~.grin\main\grin_node, testnet at ~.grin\test\grin_node. Switching the embedded node chain type will switch between these
  • When the user opens a wallet that has use_embedded_node set to false, the wallet instance should use whatever external node is configured within the wallet's grin_wallet.toml. The entire contents of the grin_wallet.toml file will be editable in settings->wallet (though this functionality isn't started at the moment, only a placeholder screen). The node tab should display a message to the effect of 'this wallet is using the node at [url]` with a status message. There should likely also be a button here that brings the user to the relevant settings field to be able to modify the node URL, (and likely an option to switch to using the embedded node as well).
  • There will be some delay starting up and shutting down nodes, so the node screen should reflect this and the wallet home screen should notify that the currently selected node is not available during those times (this is slightly separate issues, but I just want to get this down somewhere).

Between this and the work that @sheldonth is doing with opening, closing and configuring wallets, this should make the gui extremely flexible, The idea is that users should be able to create new wallets or select and run existing wallets via the gui, as well as provide total flexibility around which node is used. A new user should be led through the process of creating a new, default wallet out of the box and have a node spin up with minimal interaction.

flomang and others added 4 commits September 19, 2022 12:32
…king ownership. This allows the controller to be shutdown gracefully using the transmit channel in the NodeInterface.
…Create wallet should use state.is_testnet to set the test_node of the wallet in WalletInterface::init. The nodeinteface chain should also be set when a wallet is open.
@flomang
Copy link
Collaborator Author

flomang commented Sep 20, 2022

Still pretty messy. But making some progress on setting the appropriate chains for Node interface and Wallet interface.

Copy link
Member

@yeastplume yeastplume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good so far, and thanks for looking into this! We're still in an early phase of development, so I'll just merge what's here so far and we can forge ahead.

@yeastplume yeastplume merged commit 74920ac into mimblewimble:master Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants