cuprate-hinto-janai/consensus/rules/src/batch_verifier.rs
Boog900 8227c28604
update monero-serai (#201)
* update monero-serai

* update monero-serai + change height to `usize`

* fix merge

* fix merge

* fix doc

* fix clippy take 2

* misc changes

* move RPC imports to dev deps

* handle miner txs when calculating fee

* Update consensus/rules/src/blocks.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* Update consensus/rules/src/transactions.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* Update storage/blockchain/src/ops/tx.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* Update test-utils/src/data/free.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

* fixes

* fix clippy

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2024-08-07 00:48:53 +01:00

23 lines
964 B
Rust

use monero_serai::ringct::bulletproofs::BatchVerifier as InternalBatchVerifier;
/// This trait represents a batch verifier.
///
/// A batch verifier is used to speed up verification by verifying multiple transactions together.
///
/// Not all proofs can be batched and at its core it's intended to verify a series of statements are
/// each equivalent to zero.
pub trait BatchVerifier {
/// Queue a statement for batch verification.
///
/// # Panics
/// This function may panic if `stmt` contains calls to `rayon`'s parallel iterators, e.g. `par_iter()`.
// TODO: remove the panics by adding a generic API upstream.
fn queue_statement<R>(&mut self, stmt: impl FnOnce(&mut InternalBatchVerifier) -> R) -> R;
}
// impl this for a single threaded batch verifier.
impl BatchVerifier for &'_ mut InternalBatchVerifier {
fn queue_statement<R>(&mut self, stmt: impl FnOnce(&mut InternalBatchVerifier) -> R) -> R {
stmt(self)
}
}