From af1d64b218b7c19bb4d84d9b7fa4b519a63f4197 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 9 Jun 2020 21:17:50 +1000 Subject: [PATCH] consensus: Add a transaction verification stub Part of #428. --- zebra-consensus/src/verify.rs | 2 ++ zebra-consensus/src/verify/transaction.rs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 zebra-consensus/src/verify/transaction.rs diff --git a/zebra-consensus/src/verify.rs b/zebra-consensus/src/verify.rs index 909c4fa6..1d4d6272 100644 --- a/zebra-consensus/src/verify.rs +++ b/zebra-consensus/src/verify.rs @@ -18,6 +18,8 @@ use tower::{buffer::Buffer, Service}; use zebra_chain::block::Block; +mod transaction; + /// Block verification service. /// /// After verification, blocks and their associated transactions are added to diff --git a/zebra-consensus/src/verify/transaction.rs b/zebra-consensus/src/verify/transaction.rs new file mode 100644 index 00000000..85c14e75 --- /dev/null +++ b/zebra-consensus/src/verify/transaction.rs @@ -0,0 +1,22 @@ +//! Transaction verification for Zebra. +//! +//! Verification occurs in multiple stages: +//! - getting transactions from blocks or the mempool (disk- or network-bound) +//! - context-free verification of signatures, proofs, and scripts (CPU-bound) +//! - context-dependent verification of transactions against the chain state +//! (awaits an up-to-date chain) +//! +//! Verification is provided via a `tower::Service`, to support backpressure and batch +//! verification. +//! +//! This is an internal module. Use `verify::BlockVerifier` for blocks and their +//! transactions, or `mempool::MempoolTransactionVerifier` for mempool transactions. + +/// Internal transaction verification service. +/// +/// After verification, the transaction future completes. State changes are handled by +/// `BlockVerifier` or `MempoolTransactionVerifier`. +/// +/// `TransactionVerifier` is not yet implemented. +#[derive(Default)] +pub(crate) struct TransactionVerifier {}