Fix Sapling spend parsing #69
3 changed files with 34 additions and 9 deletions
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
|
||||
- Orchard note nullifier calculation
|
||||
- Sapling spend field parsing
|
||||
|
||||
## [0.5.5.2]
|
||||
|
||||
|
|
|
@ -401,9 +401,9 @@ impl<RW> ToHaskell<RW> for HSBundle {
|
|||
|
||||
impl HSBundle {
|
||||
pub fn from_bundle(sb: &SaplingBundle<SaplingAuthorized>) -> HSBundle {
|
||||
let s = Cursor::new(Vec::new());
|
||||
sb.authorization().binding_sig.write(s.clone()).unwrap();
|
||||
return HSBundle {empty: false, spends: Hspend::pack(sb.shielded_spends()) , outputs: HshieldedOutput::pack(sb.shielded_outputs()) , value: i64::from(sb.value_balance()) , sig: s.into_inner() }
|
||||
let mut s: Vec<u8> = Vec::new();
|
||||
sb.authorization().binding_sig.write(&mut s).unwrap();
|
||||
return HSBundle {empty: false, spends: Hspend::pack(sb.shielded_spends()) , outputs: HshieldedOutput::pack(sb.shielded_outputs()) , value: i64::from(sb.value_balance()) , sig: s }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,11 +428,11 @@ impl Hspend {
|
|||
pub fn pack(sp: &[SpendDescription<SaplingAuthorized>]) -> Vec<Hspend> {
|
||||
let mut r = Vec::new();
|
||||
for s in sp {
|
||||
let rk = Cursor::new(Vec::new());
|
||||
let authsig = Cursor::new(Vec::new());
|
||||
s.rk().write(rk.clone()).unwrap();
|
||||
s.spend_auth_sig().write(authsig.clone()).unwrap();
|
||||
r.push(Hspend {cv: Hhex{bytes:s.cv().to_bytes().to_vec()}, anchor: Hhex{bytes:s.anchor().to_bytes().to_vec()}, nullifier: Hhex{bytes:s.nullifier().to_vec()}, rk: Hhex{bytes: rk.into_inner()}, proof: Hhex{bytes:s.zkproof().to_vec()}, authsig: Hhex{bytes:authsig.into_inner()}});
|
||||
let mut rk = Vec::new();
|
||||
let mut authsig = Vec::new();
|
||||
s.rk().write(&mut rk).unwrap();
|
||||
s.spend_auth_sig().write(&mut authsig).unwrap();
|
||||
r.push(Hspend {cv: Hhex{bytes:s.cv().to_bytes().to_vec()}, anchor: Hhex{bytes:s.anchor().to_bytes().to_vec()}, nullifier: Hhex{bytes:s.nullifier().to_vec()}, rk: Hhex{bytes: rk}, proof: Hhex{bytes:s.zkproof().to_vec()}, authsig: Hhex{bytes:authsig}});
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
|
26
test/Spec.hs
26
test/Spec.hs
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue