T3 Wallet Restore fix and refactor (#1202)
* clean up wallet restore and underlying functions * rustfmt * refactor restore
This commit is contained in:
+11
-8
@@ -162,22 +162,25 @@ pub struct Output {
|
||||
impl Output {
|
||||
pub fn new(commit: &pedersen::Commitment) -> Output {
|
||||
Output {
|
||||
commit: PrintableCommitment(commit.clone()),
|
||||
commit: PrintableCommitment {
|
||||
commit: commit.clone(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PrintableCommitment(pedersen::Commitment);
|
||||
pub struct PrintableCommitment {
|
||||
pub commit: pedersen::Commitment,
|
||||
}
|
||||
|
||||
impl PrintableCommitment {
|
||||
pub fn commit(&self) -> pedersen::Commitment {
|
||||
self.0.clone()
|
||||
self.commit.clone()
|
||||
}
|
||||
|
||||
pub fn to_vec(&self) -> Vec<u8> {
|
||||
let commit = self.0;
|
||||
commit.0.to_vec()
|
||||
self.commit.0.to_vec()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,9 +215,9 @@ impl<'de> serde::de::Visitor<'de> for PrintableCommitmentVisitor {
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(PrintableCommitment(pedersen::Commitment::from_vec(
|
||||
util::from_hex(String::from(v)).unwrap(),
|
||||
)))
|
||||
Ok(PrintableCommitment {
|
||||
commit: pedersen::Commitment::from_vec(util::from_hex(String::from(v)).unwrap()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user