Kagome
Polkadot Runtime Engine in C++17
transaction.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_TRANSACTION_HPP
7 #define KAGOME_TRANSACTION_HPP
8 
9 #include "common/blob.hpp"
10 #include "primitives/extrinsic.hpp"
11 
12 namespace kagome::primitives {
13 
14  struct Transaction {
17 
19  using Priority = uint64_t;
20 
25  using Longevity = uint64_t;
26 
31  using Tag = std::vector<uint8_t>;
32 
35 
37  size_t bytes{};
38 
41 
44 
47 
48  // clang-format treats `requires` as c++20 keyword.
49  // clang-format off
51  std::vector<Tag> requires{};
52  // clang-format on
53 
55  std::vector<Tag> provides{};
56 
58  bool should_propagate{false};
59  };
60 
61  inline bool operator==(const Transaction &v1, const Transaction &v2) {
62  return v1.ext == v2.ext && v1.bytes == v2.bytes && v1.hash == v2.hash
63  && v1.priority == v2.priority && v1.valid_till == v2.valid_till
64  && v1.requires == v2.requires && v1.provides == v2.provides
66  }
67 
68 } // namespace kagome::primitives
69 
70 #endif // KAGOME_TRANSACTION_HPP
Blob< 32 > Hash256
Definition: blob.hpp:230
std::vector< Tag > provides
Tags that this transaction provides.
Definition: transaction.hpp:55
std::vector< Tag > requires
Tags required by the transaction.
Definition: transaction.hpp:51
Longevity valid_till
At which block the transaction becomes invalid?
Definition: transaction.hpp:46
bool should_propagate
Should that transaction be propagated.
Definition: transaction.hpp:58
Hash hash
Extrinsic hash (non-unique)
Definition: transaction.hpp:40
bool operator==(const Transaction &v1, const Transaction &v2)
Definition: transaction.hpp:61
size_t bytes
Number of bytes encoding of the transaction requires.
Definition: transaction.hpp:37
Priority priority
Transaction priority (higher = better)
Definition: transaction.hpp:43
std::vector< uint8_t > Tag
Definition: transaction.hpp:31
Extrinsic class represents extrinsic.
Definition: extrinsic.hpp:24
uint64_t Priority
Priority for a transaction. Additive. Higher is better.
Definition: transaction.hpp:19
Extrinsic ext
Raw extrinsic representing that transaction.
Definition: transaction.hpp:34