Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: str4d <[email protected]>
  • Loading branch information
nuttycom and str4d authored Dec 19, 2023
1 parent 422c5e3 commit e85e415
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,14 @@ impl Builder {
return Err(SpendError::SpendsDisabled);
}

let spend = SpendInfo::new(fvk, note, merkle_path).ok_or(SpendError::FvkMismatch)?;

// Consistency check: all anchors must be equal.
let cm = note.commitment();
let path_root = merkle_path.root(cm.into());
if path_root != anchor {
if !spend.has_matching_anchor(anchor) {
return Err(SpendError::AnchorMismatch);
}

self.spends
.push(SpendInfo::new(fvk, note, merkle_path).ok_or(SpendError::FvkMismatch)?);
self.spends.push(spend);

Ok(())
}
Expand Down

0 comments on commit e85e415

Please sign in to comment.