feat(wallet): mainnet pruned and full on-device chain modes
Cuprate in-process and TUI keys 1/2/3 pick mainnet pruned, mainnet full, or experimental testnet. Datadirs are split so a prune store cannot mix with a full one. Android storage floors scale with the choice. Cuprate remains pre-production; mainnet is unvalidated.
This commit is contained in:
parent
0acf89a0b4
commit
5080652e3b
11 changed files with 397 additions and 77 deletions
19
src/tui.rs
19
src/tui.rs
|
|
@ -18,7 +18,7 @@ use crate::outbox::DEFAULT_MAX_ATTEMPTS;
|
|||
use crate::qr::{self, QrPayload};
|
||||
use crate::sanitize;
|
||||
use crate::store::{Friend, FriendProfile, Message, OutboxEntry, OutboxStatus, Payment};
|
||||
use crate::wallet::{self, ChainSource};
|
||||
use crate::wallet::{self, ChainNetwork, ChainSource};
|
||||
|
||||
const C_ACCENT: Color = Color::Rgb(232, 165, 75);
|
||||
const C_TEXT: Color = Color::Rgb(196, 214, 176);
|
||||
|
|
@ -1669,6 +1669,9 @@ impl App {
|
|||
KeyCode::Char('s') => self.wallet_child_start(),
|
||||
KeyCode::Char('x') => self.wallet_child_stop(),
|
||||
KeyCode::Char('p') => self.wallet_child_probe(),
|
||||
KeyCode::Char('1') => self.set_cuprate_chain(ChainNetwork::Mainnet, true),
|
||||
KeyCode::Char('2') => self.set_cuprate_chain(ChainNetwork::Mainnet, false),
|
||||
KeyCode::Char('3') => self.set_cuprate_chain(ChainNetwork::Testnet, false),
|
||||
KeyCode::Char('c') => {
|
||||
self.screen = Screen::WalletSetup(WalletSetup::CreateWarn {
|
||||
typed: String::new(),
|
||||
|
|
@ -2142,6 +2145,16 @@ impl App {
|
|||
self.status_note = Some(self.wallet_child_note());
|
||||
}
|
||||
|
||||
fn set_cuprate_chain(&mut self, network: ChainNetwork, prune: bool) {
|
||||
self.status_note = Some(match self.node.set_in_process_cuprate(network, prune) {
|
||||
Ok(()) => format!(
|
||||
"chain source: {}",
|
||||
self.node.wallet_child_config().source.label()
|
||||
),
|
||||
Err(e) => format!("chain source: {e}"),
|
||||
});
|
||||
}
|
||||
|
||||
/// The child status line, or the copy that names what is missing.
|
||||
fn wallet_child_note(&mut self) -> String {
|
||||
let line = self.rt.block_on(self.node.wallet_child_refresh()).line();
|
||||
|
|
@ -3179,7 +3192,9 @@ match screen {
|
|||
BackupKind::Restore => "type RESTORE Esc cancel ? help",
|
||||
},
|
||||
Screen::Passphrase { .. } => "Enter submit Esc cancel ? help",
|
||||
Screen::Wallet { .. } => "c create i import r qr s/x child Esc back ? help",
|
||||
Screen::Wallet { .. } => {
|
||||
"c create i import r qr s/x child 1 pruned 2 full 3 testnet Esc back ? help"
|
||||
}
|
||||
Screen::WalletSetup(WalletSetup::CreateWarn { .. }) => "type SPEND Esc cancel ? help",
|
||||
Screen::WalletSetup(WalletSetup::CreatePass { .. } | WalletSetup::ImportPass { .. }) => {
|
||||
"Enter submit Esc cancel ? help"
|
||||
|
|
|
|||
Loading…
Reference in a new issue