Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #ifndef IROHA_TRANSACTION_HPP
7 : #define IROHA_TRANSACTION_HPP
8 :
9 : #include <memory>
10 : #include <string>
11 : #include <vector>
12 :
13 : #include "crypto/hash_types.hpp"
14 : #include "datetime/time.hpp"
15 : #include "model/command.hpp"
16 : #include "model/signature.hpp"
17 :
18 : namespace iroha {
19 : namespace model {
20 :
21 : /**
22 : * Transaction is a Model-structure that provides abstraction to bunch of
23 : * commands with signatures and meta-data.
24 : * Transaction can be divided to {Header, Meta, Body}.
25 : */
26 : struct Transaction {
27 : /**
28 : * List of signatories that sign transaction
29 : * HEADER field
30 : */
31 17 : std::vector<Signature> signatures{};
32 :
33 : using SignaturesType = decltype(signatures);
34 :
35 : using TimeType = ts64_t;
36 :
37 : /**
38 : * Creation timestamp
39 : * HEADER field
40 : */
41 17 : TimeType created_ts{};
42 :
43 : /**
44 : * Account id of transaction creator.
45 : * META field
46 : */
47 17 : std::string creator_account_id{};
48 :
49 : /**
50 : * Quorum means number of signatures required for processing transaction
51 : * in system.
52 : * This field should be > 0.
53 : */
54 17 : uint8_t quorum = 1;
55 :
56 : /**
57 : * Bunch of commands attached to transaction
58 : * shared_ptr is used since Proposal has to be copied
59 : * BODY field
60 : */
61 17 : std::vector<std::shared_ptr<Command>> commands{};
62 :
63 : using CommandsType = decltype(commands);
64 :
65 : bool operator==(const Transaction &rhs) const;
66 : bool operator!=(const Transaction &rhs) const;
67 : };
68 : } // namespace model
69 : } // namespace iroha
70 : #endif // IROHA_TRANSACTION_HPP
|