From 997201c9c7fe784097f5c27bcebf55eb09dc6b68 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 9 Jun 2020 21:17:16 +1000 Subject: [PATCH] consensus: Add a mempool stub --- zebra-consensus/src/lib.rs | 4 +++- zebra-consensus/src/mempool.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 zebra-consensus/src/mempool.rs diff --git a/zebra-consensus/src/lib.rs b/zebra-consensus/src/lib.rs index 5054fa47..44c83cf5 100644 --- a/zebra-consensus/src/lib.rs +++ b/zebra-consensus/src/lib.rs @@ -3,7 +3,8 @@ //! `verify::BlockVerifier` verifies blocks and their transactions, then adds them to //! `zebra_state::ZebraState`. //! -//! `mempool::ZebraMempool` verifies transactions, and adds them to the mempool state. +//! `mempool::MempoolTransactionVerifier` verifies transactions, and adds them to +//! `mempool::ZebraMempoolState`. //! //! Consensus handling is provided using `tower::Service`s, to support backpressure //! and batch verification. @@ -12,4 +13,5 @@ #![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_consensus")] #![deny(missing_docs)] +pub mod mempool; pub mod verify; diff --git a/zebra-consensus/src/mempool.rs b/zebra-consensus/src/mempool.rs new file mode 100644 index 00000000..e1e5f95b --- /dev/null +++ b/zebra-consensus/src/mempool.rs @@ -0,0 +1,29 @@ +//! Mempool transaction verification and state for Zebra. +//! +//! Mempool updates occur in multiple stages: +//! - getting transactions (disk- or network-bound) +//! - context-free verification of signatures, proofs, and scripts (CPU-bound) +//! - context-dependent verification of mempool transactions against the chain state +//! (awaits an up-to-date chain) +//! - adding transactions to the mempool +//! +//! The mempool is provided via a `tower::Service`, to support backpressure and batch +//! verification. + +/// Mempool state. +/// +/// New transactions are verified, checked against the chain state, then added to the +/// mempool. +/// +/// `ZebraMempoolState` is not yet implemented. +#[derive(Default)] +struct ZebraMempoolState {} + +/// Mempool transaction verification. +/// +/// New transactions are verified, checked against the chain state, then added to the +/// mempool. +/// +/// `MempoolTransactionVerifier` is not yet implemented. +#[derive(Default)] +struct MempoolTransactionVerifier {}