重构代码
This commit is contained in:
parent
6a54cc5f4f
commit
16bf534ceb
@ -110,19 +110,13 @@ impl Wallet {
|
||||
let key_str_0: &str = &self.master_key;
|
||||
let key0 = BigInt::parse_bytes(&key_str_0.as_bytes(), 16).unwrap();
|
||||
let kp0: (usize, BigInt) = (1, key0);
|
||||
let i: usize;
|
||||
let key_str_1: &str;
|
||||
if let Some(val) = &self.second_key {
|
||||
i = 2;
|
||||
key_str_1 = val;
|
||||
} else if let Some(val) = &self.backup_key {
|
||||
i = 3;
|
||||
key_str_1 = val;
|
||||
} else {
|
||||
println!("error");
|
||||
i = 2;
|
||||
key_str_1 = "";
|
||||
}
|
||||
let (i, key_str_1) = match (&self.second_key, &self.backup_key) {
|
||||
(Some(val), _) => (2, val),
|
||||
(_, Some(val)) => (3, val),
|
||||
_ => {
|
||||
panic!("error generate key")
|
||||
}
|
||||
};
|
||||
let key1 = BigInt::parse_bytes(&key_str_1.as_bytes(), 16).unwrap();
|
||||
let kp1 = (i, key1);
|
||||
let _tmp = vec![kp0, kp1];
|
||||
@ -172,6 +166,7 @@ impl Wallet {
|
||||
write!(s, "{:02x}", rv).unwrap();
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
pub fn sign_for_tran<S>(&self, msg: S) -> Result<(String, i32)>
|
||||
where
|
||||
S: AsRef<[u8]>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user