Browse Source

restore 10 zaddr by default, and allow variable zaddr size

pull/167/head
DenioD 4 years ago
parent
commit
5f67dd4a32
  1. 6
      lib/Cargo.lock
  2. 2
      lib/Cargo.toml
  3. 2
      lib/silentdragonlitelib.h
  4. 4
      lib/src/lib.rs
  5. 6
      src/firsttimewizard.cpp
  6. 30
      src/restoreseed.ui

6
lib/Cargo.lock

@ -1192,7 +1192,7 @@ dependencies = [
"blake3 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=d2887d07879a93bdd9b2c8bd12504bb977e82fe0)",
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=07288de82d84b9bf35d1210ccc98eb1e4b757eb7)",
]
[[package]]
@ -1655,7 +1655,7 @@ dependencies = [
[[package]]
name = "silentdragonlitelib"
version = "0.1.0"
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=d2887d07879a93bdd9b2c8bd12504bb977e82fe0#d2887d07879a93bdd9b2c8bd12504bb977e82fe0"
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=07288de82d84b9bf35d1210ccc98eb1e4b757eb7#07288de82d84b9bf35d1210ccc98eb1e4b757eb7"
dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
@ -2647,7 +2647,7 @@ dependencies = [
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=d2887d07879a93bdd9b2c8bd12504bb977e82fe0)" = "<none>"
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=07288de82d84b9bf35d1210ccc98eb1e4b757eb7)" = "<none>"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"

2
lib/Cargo.toml

@ -12,4 +12,4 @@ crate-type = ["staticlib"]
libc = "0.2.58"
lazy_static = "1.4.0"
blake3 = "0.3.4"
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "d2887d07879a93bdd9b2c8bd12504bb977e82fe0" }
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "07288de82d84b9bf35d1210ccc98eb1e4b757eb7" }

2
lib/silentdragonlitelib.h

@ -9,7 +9,7 @@ extern bool litelib_wallet_exists (const char* chain_name);
extern char * litelib_initialize_new (bool dangerous, const char* server);
extern char * litelib_initialize_new_from_phrase
(bool dangerous, const char* server, const char* seed,
unsigned long long birthday);
unsigned long long birthday, unsigned long long number);
extern char * litelib_initialize_existing (bool dangerous, const char* server);
extern char * litelib_execute (const char* s, const char* args);
extern void litelib_rust_free_string (char* s);

4
lib/src/lib.rs

@ -102,7 +102,7 @@ pub extern fn litelib_initialize_new(dangerous: bool, server: *const c_char) ->
/// Restore a wallet from the seed phrase
#[no_mangle]
pub extern fn litelib_initialize_new_from_phrase(dangerous: bool, server: *const c_char,
seed: *const c_char, birthday: u64) -> *mut c_char {
seed: *const c_char, birthday: u64, number: u64) -> *mut c_char {
let server_str = unsafe {
assert!(!server.is_null());
@ -124,7 +124,7 @@ pub extern fn litelib_initialize_new_from_phrase(dangerous: bool, server: *const
}
};
let lightclient = match LightClient::new_from_phrase(seed_str, &config, birthday) {
let lightclient = match LightClient::new_from_phrase(seed_str, &config, birthday, number, false) {
Ok(l) => l,
Err(e) => {
let e_str = CString::new(format!("Error: {}", e)).unwrap();

6
src/firsttimewizard.cpp

@ -242,10 +242,14 @@ bool RestoreSeedPage::validatePage() {
return false;
}
///Number
QString number_str = form.number->text();
qint64 number = number_str.toUInt();
// 3. Attempt to restore wallet with the seed phrase
{
char* resp = litelib_initialize_new_from_phrase(parent->dangerous, parent->server.toStdString().c_str(),
seed.toStdString().c_str(), birthday);
seed.toStdString().c_str(), birthday, number);
QString reply = litelib_process_response(resp);
if (reply.toUpper().trimmed() != "OK") {

30
src/restoreseed.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>494</width>
<height>522</height>
</rect>
</property>
<property name="windowTitle">
@ -35,36 +35,36 @@
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Wallet Seed</string>
</property>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QPlainTextEdit" name="txtSeed">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Wallet Birthday</string>
</property>
</widget>
</item>
<item>
<item row="3" column="0">
<widget class="QLineEdit" name="txtBirthday">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
@ -79,6 +79,20 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Number</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLineEdit" name="number">
<property name="text">
<string>10</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save