fix(ecash): repair two mangled warning messages
Both import refusals reached the operator with runs of ~18 spaces mid sentence — "Importing a different one means coins minted…". The string literals had been written as single long lines with the line-continuation whitespace baked in rather than escaped, so Rust preserved it verbatim. Only visible once the sanitizer stopped swallowing these messages, which is its own small lesson: the text had been wrong since it was written and nothing could show it. Cosmetic, but not trivially so — this is the warning that stops someone replacing the phrase their balance was minted under, and text that looks broken is text people stop reading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c19c411b91
commit
8bc161f40f
@@ -282,7 +282,9 @@ pub async fn establish_independent(data_dir: &Path) -> Result<EcashSeed> {
|
|||||||
pub async fn import_mnemonic(data_dir: &Path, words: &str, confirm: bool) -> Result<EcashSeed> {
|
pub async fn import_mnemonic(data_dir: &Path, words: &str, confirm: bool) -> Result<EcashSeed> {
|
||||||
let mnemonic: bip39::Mnemonic = words.split_whitespace().collect::<Vec<_>>().join(" ").parse()
|
let mnemonic: bip39::Mnemonic = words.split_whitespace().collect::<Vec<_>>().join(" ").parse()
|
||||||
.map_err(|e| anyhow::anyhow!(
|
.map_err(|e| anyhow::anyhow!(
|
||||||
"That is not a valid BIP-39 recovery phrase: {e}. Check for typos — every word must come from the BIP-39 word list, and the phrase as a whole carries a checksum."
|
"That is not a valid BIP-39 recovery phrase: {e}. Check for typos — \
|
||||||
|
every word must come from the BIP-39 word list, and the phrase as \
|
||||||
|
a whole carries a checksum."
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
if let Some(existing) = load_seed(data_dir).await? {
|
if let Some(existing) = load_seed(data_dir).await? {
|
||||||
@@ -293,7 +295,11 @@ pub async fn import_mnemonic(data_dir: &Path, words: &str, confirm: bool) -> Res
|
|||||||
}
|
}
|
||||||
if !confirm {
|
if !confirm {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"This wallet already has a backup phrase. Importing a different one means coins minted under the current phrase will no longer be restorable from words — they stay spendable, but a restore will not find them. Reveal and write down the current phrase first, then confirm to replace it."
|
"This wallet already has a backup phrase. Importing a different one \
|
||||||
|
means coins minted under the current phrase will no longer be \
|
||||||
|
restorable from words — they stay spendable, but a restore will \
|
||||||
|
not find them. Reveal and write down the current phrase first, \
|
||||||
|
then confirm to replace it."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
archive_seed(data_dir).await?;
|
archive_seed(data_dir).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user