OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
status_update.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_WATCHTOWER_STATUS_UPDATE_H_
7#define OPENCBDC_TX_SRC_WATCHTOWER_STATUS_UPDATE_H_
8
12
13#include <memory>
14#include <optional>
15#include <unordered_map>
16#include <unordered_set>
17
18namespace cbdc::watchtower {
43
45 using tx_id_uhs_ids = std::unordered_map<hash_t,
46 std::vector<hash_t>,
48
52 public:
53 friend auto
60
61 auto operator==(const status_update_request& rhs) const -> bool;
62
64
68
72
75 [[nodiscard]] auto uhs_ids() const -> const tx_id_uhs_ids&;
76
77 private:
79 tx_id_uhs_ids m_uhs_ids;
80 };
81
85 public:
86 friend auto
90 friend auto
95
96 auto operator==(const status_update_state& rhs) const -> bool;
97
103 uint64_t block_height,
104 hash_t uhs_id);
105
109
112 [[nodiscard]] auto status() const -> search_status;
113
118 [[nodiscard]] auto block_height() const -> uint64_t;
119
122 [[nodiscard]] auto uhs_id() const -> hash_t;
123
124 private:
125 status_update_state() = default;
126
127 search_status m_status{};
128 uint64_t m_block_height{};
129 hash_t m_uhs_id{};
130 };
131
133 using tx_id_states = std::unordered_map<hash_t,
134 std::vector<status_update_state>,
136
140 public:
141 friend auto cbdc::operator<<(
142 cbdc::serializer& packet,
145 friend auto
149
150 auto operator==(const status_request_check_success& rhs) const -> bool;
151
153
157
161
166 [[nodiscard]] auto states() const -> const tx_id_states&;
167
168 private:
169 tx_id_states m_states;
170 };
171}
172
173#endif // OPENCBDC_TX_SRC_WATCHTOWER_STATUS_UPDATE_H_
Interface for serializing objects into and out of raw bytes representations.
Indicates a successful check request, sent with a StatusUpdateResponse.
Network request to interact with the Watchtower's status update service.
auto uhs_ids() const -> const tx_id_uhs_ids &
UHS IDs for which the client would like to search.
auto operator==(const status_update_request &rhs) const -> bool
Represents the internal state of an ongoing status update request.
search_status
The current status of the Watchtower's progress in searching for a particular UHS ID.
@ invalid_input
The transaction processing system rejected the transaction because the requested UHS ID was already s...
@ spent
The STXO set contains the requested UHS ID.
@ unspent
The UTXO set contains the requested UHS ID.
@ internal_error
The transaction processing system failed to process the transaction containing the requested UHS ID d...
@ tx_rejected
The transaction processing system rejected the requested UHS ID's transaction due to a problem with a...
@ no_history
The Watchtower has finished scanning the block history for the UHS ID in the request and hasn't found...
std::unordered_map< hash_t, std::vector< hash_t >, hashing::const_sip_hash< hash_t > > tx_id_uhs_ids
Set of UHS IDs to query, keyed by Tx IDs.
std::unordered_map< hash_t, std::vector< status_update_state >, hashing::const_sip_hash< hash_t > > tx_id_states
Reported UHS ID states, keyed by Tx IDs.
std::array< unsigned char, cbdc::hash_size > hash_t
SHA256 hash container.
auto operator>>(serializer &deser, parsec::agent::rpc::request &req) -> serializer &
auto operator<<(serializer &ser, const parsec::agent::rpc::request &req) -> serializer &
Watchtower module to process and cache block history.
SipHash function to generate STL data structure hash keys for system IDs.
Definition hashmap.hpp:27