New: Warn about potential testnet v mainnet database contamination.

This commit is contained in:
Kevin Gorham 2021-03-31 08:22:46 -04:00
parent eeafbd8c2f
commit c761071d6f
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
1 changed files with 10 additions and 1 deletions

View File

@ -93,6 +93,7 @@ class Initializer constructor(appContext: Context, config: Config) : SdkSynchron
)
twig("seeded the database with sapling tree at height ${birthday.height}")
}
twig("database file: ${rustBackend.pathDataDb}")
}
/**
@ -393,6 +394,14 @@ internal fun validateAlias(alias: String) {
alias.all { it.isLetterOrDigit() || it == '_' }
) {
"ERROR: Invalid alias ($alias). For security, the alias must be shorter than 100 " +
"characters and only contain letters, digits or underscores and start with a letter"
"characters and only contain letters, digits or underscores and start with a letter; " +
"ideally, it would also differentiate across mainnet and testnet but that is not " +
"enforced."
}
// TODO: consider exposing this as a proper warning that can be received by apps, since most apps won't use logging
if (alias.toLowerCase().contains(BuildConfig.FLAVOR.toLowerCase())) {
twig("WARNING: alias does not contain the build flavor but it probably should to help" +
" prevent testnet data from contaminating mainnet data.")
}
}