Zecale - Reconciling Privacy and Scalability on Smart-Contract Chains  0.5
Reference implementation of the Zecale protocol by Clearmatics
application_pool.hpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
5 #ifndef __ZECALE_CORE_APPLICATION_POOL_HPP__
6 #define __ZECALE_CORE_APPLICATION_POOL_HPP__
7 
8 #include "nested_transaction.hpp"
9 
10 #include <queue>
11 
12 namespace libzecale
13 {
14 
21 template<typename nppT, typename nsnarkT, size_t NumProofs>
23 {
24 private:
26  const std::string _name;
27 
29  const typename nsnarkT::verification_key _verification_key;
30 
32  std::priority_queue<nested_transaction<nppT, nsnarkT>> _tx_pool;
33 
34 public:
36  const std::string &name, const typename nsnarkT::verification_key &vk);
37 
38  // Prevent some operations which may have unintended consequences and
39  // unnecessary allocation and copying.
40 
41  application_pool(const application_pool &other) = delete;
42  application_pool &operator=(const application_pool &other) = delete;
43 
44  const std::string &name() const;
45 
49  const typename nsnarkT::verification_key &verification_key() const;
50 
53 
55  size_t tx_pool_size() const;
56 
57  // TODO: Use better types to make it safer to retrieve smaller batches.
58 
62  size_t get_next_batch(
63  std::array<nested_transaction<nppT, nsnarkT>, NumProofs> &batch);
64 };
65 
66 } // namespace libzecale
67 
69 
70 #endif // __ZECALE_CORE_APPLICATION_POOL_HPP__
libzecale::application_pool::get_next_batch
size_t get_next_batch(std::array< nested_transaction< nppT, nsnarkT >, NumProofs > &batch)
libzecale::nested_transaction
Definition: nested_transaction.hpp:17
libzecale
Definition: aggregator_circuit.hpp:15
libzecale::application_pool::add_tx
void add_tx(const nested_transaction< nppT, nsnarkT > &tx)
Add transaction to the pool.
libzecale::application_pool::verification_key
const nsnarkT::verification_key & verification_key() const
libzecale::application_pool
Definition: application_pool.hpp:22
libzecale::application_pool::name
const std::string & name() const
libzecale::application_pool::application_pool
application_pool(const std::string &name, const typename nsnarkT::verification_key &vk)
libzecale::application_pool::operator=
application_pool & operator=(const application_pool &other)=delete
libzecale::application_pool::tx_pool_size
size_t tx_pool_size() const
Returns the number of transactions in the _tx_pool.
application_pool.tcc
nested_transaction.hpp