Skip to content

Commit

Permalink
Merge pull request #46 from worldcoin/osiris/better-tx-validation
Browse files Browse the repository at this point in the history
Osiris/better tx validation
  • Loading branch information
0xOsiris authored Oct 28, 2024
2 parents 8d60a1e + 64bde60 commit 3c86f4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions world-chain-builder/src/pool/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ where
transaction: &Tx,
payload: &PbhPayload,
) -> Result<(), TransactionValidationError> {
self.validate_root(payload)?;
let date = chrono::Utc::now();
self.validate_external_nullifier(date, payload)?;

// Create db transaction and insert the nullifier hash
// We do this first to prevent repeatedly validating the same transaction
let db_tx = self.pbh_db.tx_mut()?;
let mut cursor = db_tx.cursor_write::<ValidatedPbhTransactionTable>()?;
cursor.insert(payload.nullifier_hash.to_be_bytes().into(), EmptyValue)?;

let date = chrono::Utc::now();
self.validate_root(payload)?;
self.validate_external_nullifier(date, payload)?;

let res = verify_proof(
payload.root,
payload.nullifier_hash,
Expand Down

0 comments on commit 3c86f4b

Please sign in to comment.