Skip to content

Commit

Permalink
Android: make app use the same private key validation function as the…
Browse files Browse the repository at this point in the history
… wallet creation process (closes #2133)
  • Loading branch information
mhsmith committed Jan 29, 2021
1 parent 5930def commit 8775ea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
if (ecVersion == null) {
throw new GradleException("Couldn't find version number")
}
def BUILD_NUM = 2 // Distinguish multiple releases with the same version number.
def BUILD_NUM = 3 // Distinguish multiple releases with the same version number.
versionName "$ecVersion-$BUILD_NUM"
def verParsed = ecVersion.split(/\./).collect { Integer.parseInt(it) }
versionCode((verParsed[0] * 1000000) + (verParsed[1] * 10000) + (verParsed[2] * 100) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,14 @@ class NewWalletImportDialog : NewWalletDialog2() {
// Can happen at start or end of list.
} else if (clsAddress.callAttr("is_valid", word).toBoolean()) {
foundAddress = true
} else if (libBitcoin.callAttr("is_private_key", word).toBoolean()) {
foundPrivkey = true
} else {
throw ToastException(getString(R.string.not_a_valid, word))
try {
// Use the same function as the wallet creation process (#2133).
libAddress.get("PublicKey")!!.callAttr("from_WIF_privkey", word)
foundPrivkey = true
} catch (e: PyException) {
throw ToastException(getString(R.string.not_a_valid, word))
}
}
}

Expand Down

0 comments on commit 8775ea2

Please sign in to comment.