mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 990 forks source link

Override global one times. #3737

Closed flomang closed 2 years ago

flomang commented 2 years ago

The grin-gui needs to be able to start the embedded node either in Testnet or Mainnet. If the user selects a Testnet wallet while the embedded node is running on Mainnet the grin-gui shall shutdown the Mainnet node and restart a Testnet node. Unfortunately, since the initglobal... calls need to be called again with different parameters (i.e. change chain_type, fee, etc) the OneTime panics.

These functions shall permit the globals to be set again so the grin-gui can dynamically change its global context for Mainnet or Testnet.

yeastplume commented 2 years ago

Okay, this seems all fine, just one small change noted above. This affects the core crate, but the new functions aren't called from anywhere else, just used by the grin-gui project.

flomang commented 2 years ago

Yes, these functions are only really needed for the gui atm. I was thinking maybe a feature?

yeastplume commented 2 years ago

Yes, these functions are only really needed for the gui atm. I was thinking maybe a feature?

Think we're fine as is, no need to complicate with features since there are no downsides to including this.