open-core 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +8 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +15 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +202 -0
- data/README.md +83 -0
- data/Rakefile +4 -0
- data/examples/create_account.rb +26 -0
- data/examples/low_level_transaction_post.rb +46 -0
- data/examples/mid_level_transaction_post.rb +33 -0
- data/examples/non_native_payment.rb +60 -0
- data/examples/offer.rb +75 -0
- data/examples/transaction_merge.rb +23 -0
- data/generated/stellar-base-generated.rb +134 -0
- data/generated/stellar/account_entry.rb +53 -0
- data/generated/stellar/account_entry/ext.rb +24 -0
- data/generated/stellar/account_flags.rb +27 -0
- data/generated/stellar/account_merge_result.rb +26 -0
- data/generated/stellar/account_merge_result_code.rb +30 -0
- data/generated/stellar/allow_trust_op.rb +38 -0
- data/generated/stellar/allow_trust_op/asset.rb +33 -0
- data/generated/stellar/allow_trust_result.rb +25 -0
- data/generated/stellar/allow_trust_result_code.rb +31 -0
- data/generated/stellar/asset.rb +47 -0
- data/generated/stellar/asset/alpha_num12.rb +22 -0
- data/generated/stellar/asset/alpha_num4.rb +22 -0
- data/generated/stellar/asset_type.rb +24 -0
- data/generated/stellar/bucket_entry.rb +28 -0
- data/generated/stellar/bucket_entry_type.rb +22 -0
- data/generated/stellar/change_trust_op.rb +22 -0
- data/generated/stellar/change_trust_result.rb +25 -0
- data/generated/stellar/change_trust_result_code.rb +30 -0
- data/generated/stellar/claim_offer_atom.rb +33 -0
- data/generated/stellar/create_account_op.rb +20 -0
- data/generated/stellar/create_account_result.rb +25 -0
- data/generated/stellar/create_account_result_code.rb +32 -0
- data/generated/stellar/create_passive_offer_op.rb +24 -0
- data/generated/stellar/crypto_key_type.rb +20 -0
- data/generated/stellar/decorated_signature.rb +20 -0
- data/generated/stellar/dont_have.rb +20 -0
- data/generated/stellar/envelope_type.rb +22 -0
- data/generated/stellar/error.rb +20 -0
- data/generated/stellar/hello.rb +26 -0
- data/generated/stellar/inflation_payout.rb +20 -0
- data/generated/stellar/inflation_result.rb +26 -0
- data/generated/stellar/inflation_result_code.rb +24 -0
- data/generated/stellar/ledger_entry.rb +44 -0
- data/generated/stellar/ledger_entry/data.rb +33 -0
- data/generated/stellar/ledger_entry/ext.rb +24 -0
- data/generated/stellar/ledger_entry_change.rb +31 -0
- data/generated/stellar/ledger_entry_change_type.rb +24 -0
- data/generated/stellar/ledger_entry_type.rb +24 -0
- data/generated/stellar/ledger_header.rb +65 -0
- data/generated/stellar/ledger_header/ext.rb +24 -0
- data/generated/stellar/ledger_header_history_entry.rb +33 -0
- data/generated/stellar/ledger_header_history_entry/ext.rb +24 -0
- data/generated/stellar/ledger_key.rb +50 -0
- data/generated/stellar/ledger_key/account.rb +20 -0
- data/generated/stellar/ledger_key/offer.rb +22 -0
- data/generated/stellar/ledger_key/trust_line.rb +22 -0
- data/generated/stellar/ledger_upgrade.rb +27 -0
- data/generated/stellar/ledger_upgrade_type.rb +22 -0
- data/generated/stellar/manage_offer_effect.rb +24 -0
- data/generated/stellar/manage_offer_op.rb +28 -0
- data/generated/stellar/manage_offer_result.rb +26 -0
- data/generated/stellar/manage_offer_result_code.rb +48 -0
- data/generated/stellar/manage_offer_success_result.rb +34 -0
- data/generated/stellar/manage_offer_success_result/offer.rb +30 -0
- data/generated/stellar/memo.rb +38 -0
- data/generated/stellar/memo_type.rb +28 -0
- data/generated/stellar/message_type.rb +45 -0
- data/generated/stellar/offer_entry.rb +49 -0
- data/generated/stellar/offer_entry/ext.rb +24 -0
- data/generated/stellar/offer_entry_flags.rb +21 -0
- data/generated/stellar/operation.rb +51 -0
- data/generated/stellar/operation/body.rb +60 -0
- data/generated/stellar/operation_meta.rb +18 -0
- data/generated/stellar/operation_result.rb +53 -0
- data/generated/stellar/operation_result/tr.rb +61 -0
- data/generated/stellar/operation_result_code.rb +25 -0
- data/generated/stellar/operation_type.rb +38 -0
- data/generated/stellar/path_payment_op.rb +32 -0
- data/generated/stellar/path_payment_result.rb +34 -0
- data/generated/stellar/path_payment_result/success.rb +22 -0
- data/generated/stellar/path_payment_result_code.rb +45 -0
- data/generated/stellar/payment_op.rb +22 -0
- data/generated/stellar/payment_result.rb +25 -0
- data/generated/stellar/payment_result_code.rb +39 -0
- data/generated/stellar/peer_address.rb +22 -0
- data/generated/stellar/price.rb +20 -0
- data/generated/stellar/public_key.rb +23 -0
- data/generated/stellar/scp_ballot.rb +20 -0
- data/generated/stellar/scp_envelope.rb +20 -0
- data/generated/stellar/scp_nomination.rb +22 -0
- data/generated/stellar/scp_quorum_set.rb +22 -0
- data/generated/stellar/scp_statement.rb +59 -0
- data/generated/stellar/scp_statement/pledges.rb +64 -0
- data/generated/stellar/scp_statement/pledges/confirm.rb +28 -0
- data/generated/stellar/scp_statement/pledges/externalize.rb +28 -0
- data/generated/stellar/scp_statement/pledges/prepare.rb +32 -0
- data/generated/stellar/scp_statement_type.rb +26 -0
- data/generated/stellar/set_options_op.rb +41 -0
- data/generated/stellar/set_options_result.rb +25 -0
- data/generated/stellar/set_options_result_code.rb +38 -0
- data/generated/stellar/signer.rb +20 -0
- data/generated/stellar/simple_payment_result.rb +22 -0
- data/generated/stellar/stellar_message.rb +66 -0
- data/generated/stellar/stellar_value.rb +40 -0
- data/generated/stellar/stellar_value/ext.rb +24 -0
- data/generated/stellar/threshold_indexes.rb +26 -0
- data/generated/stellar/time_bounds.rb +20 -0
- data/generated/stellar/transaction.rb +50 -0
- data/generated/stellar/transaction/ext.rb +24 -0
- data/generated/stellar/transaction_envelope.rb +20 -0
- data/generated/stellar/transaction_history_entry.rb +33 -0
- data/generated/stellar/transaction_history_entry/ext.rb +24 -0
- data/generated/stellar/transaction_history_result_entry.rb +33 -0
- data/generated/stellar/transaction_history_result_entry/ext.rb +24 -0
- data/generated/stellar/transaction_meta.rb +31 -0
- data/generated/stellar/transaction_meta/v0.rb +22 -0
- data/generated/stellar/transaction_result.rb +43 -0
- data/generated/stellar/transaction_result/ext.rb +24 -0
- data/generated/stellar/transaction_result/result.rb +30 -0
- data/generated/stellar/transaction_result_code.rb +45 -0
- data/generated/stellar/transaction_result_pair.rb +20 -0
- data/generated/stellar/transaction_result_set.rb +18 -0
- data/generated/stellar/transaction_set.rb +20 -0
- data/generated/stellar/trust_line_entry.rb +41 -0
- data/generated/stellar/trust_line_entry/ext.rb +24 -0
- data/generated/stellar/trust_line_flags.rb +21 -0
- data/lib/stellar-base.rb +32 -0
- data/lib/stellar/account_flags.rb +28 -0
- data/lib/stellar/asset.rb +69 -0
- data/lib/stellar/base.rb +1 -0
- data/lib/stellar/base/version.rb +5 -0
- data/lib/stellar/convert.rb +32 -0
- data/lib/stellar/key_pair.rb +112 -0
- data/lib/stellar/networks.rb +45 -0
- data/lib/stellar/operation.rb +304 -0
- data/lib/stellar/path_payment_result.rb +17 -0
- data/lib/stellar/price.rb +32 -0
- data/lib/stellar/thresholds.rb +39 -0
- data/lib/stellar/transaction.rb +170 -0
- data/lib/stellar/transaction_envelope.rb +32 -0
- data/lib/stellar/util/continued_fraction.rb +96 -0
- data/lib/stellar/util/strkey.rb +43 -0
- data/open-core.gemspec +37 -0
- data/spec/lib/stellar/account_flags_spec.rb +19 -0
- data/spec/lib/stellar/asset_spec.rb +45 -0
- data/spec/lib/stellar/convert_spec.rb +61 -0
- data/spec/lib/stellar/key_pair_spec.rb +238 -0
- data/spec/lib/stellar/networks_spec.rb +77 -0
- data/spec/lib/stellar/path_payment_result_spec.rb +95 -0
- data/spec/lib/stellar/price_spec.rb +34 -0
- data/spec/lib/stellar/thresholds_spec.rb +62 -0
- data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
- data/spec/lib/stellar/transaction_spec.rb +54 -0
- data/spec/lib/stellar/util/strkey_spec.rb +46 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/matchers/be_strkey.rb +9 -0
- data/spec/support/matchers/eq_bytes.rb +5 -0
- data/spec/support/matchers/have_length.rb +5 -0
- data/tasks/rspec.rake +6 -0
- data/tasks/travis.rake +1 -0
- data/tasks/xdr.rake +50 -0
- data/xdr/Stellar-SCP.x +87 -0
- data/xdr/Stellar-ledger-entries.x +222 -0
- data/xdr/Stellar-ledger.x +231 -0
- data/xdr/Stellar-overlay.x +87 -0
- data/xdr/Stellar-transaction.x +670 -0
- data/xdr/Stellar-types.x +34 -0
- metadata +444 -0
@@ -0,0 +1,222 @@
|
|
1
|
+
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
|
2
|
+
// under the Apache License, Version 2.0. See the COPYING file at the root
|
3
|
+
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
|
5
|
+
%#include "xdr/Stellar-types.h"
|
6
|
+
|
7
|
+
namespace stellar
|
8
|
+
{
|
9
|
+
|
10
|
+
typedef PublicKey AccountID;
|
11
|
+
typedef opaque Thresholds[4];
|
12
|
+
typedef string string32<32>;
|
13
|
+
typedef uint64 SequenceNumber;
|
14
|
+
|
15
|
+
enum AssetType
|
16
|
+
{
|
17
|
+
ASSET_TYPE_NATIVE = 0,
|
18
|
+
ASSET_TYPE_CREDIT_ALPHANUM4 = 1,
|
19
|
+
ASSET_TYPE_CREDIT_ALPHANUM12 = 2
|
20
|
+
};
|
21
|
+
|
22
|
+
union Asset switch (AssetType type)
|
23
|
+
{
|
24
|
+
case ASSET_TYPE_NATIVE: // Not credit
|
25
|
+
void;
|
26
|
+
|
27
|
+
case ASSET_TYPE_CREDIT_ALPHANUM4:
|
28
|
+
struct
|
29
|
+
{
|
30
|
+
opaque assetCode[4];
|
31
|
+
AccountID issuer;
|
32
|
+
} alphaNum4;
|
33
|
+
|
34
|
+
case ASSET_TYPE_CREDIT_ALPHANUM12:
|
35
|
+
struct
|
36
|
+
{
|
37
|
+
opaque assetCode[12];
|
38
|
+
AccountID issuer;
|
39
|
+
} alphaNum12;
|
40
|
+
|
41
|
+
// add other asset types here in the future
|
42
|
+
};
|
43
|
+
|
44
|
+
// price in fractional representation
|
45
|
+
struct Price
|
46
|
+
{
|
47
|
+
int32 n; // numerator
|
48
|
+
int32 d; // denominator
|
49
|
+
};
|
50
|
+
|
51
|
+
// the 'Thresholds' type is packed uint8_t values
|
52
|
+
// defined by these indexes
|
53
|
+
enum ThresholdIndexes
|
54
|
+
{
|
55
|
+
THRESHOLD_MASTER_WEIGHT = 0,
|
56
|
+
THRESHOLD_LOW = 1,
|
57
|
+
THRESHOLD_MED = 2,
|
58
|
+
THRESHOLD_HIGH = 3
|
59
|
+
};
|
60
|
+
|
61
|
+
enum LedgerEntryType
|
62
|
+
{
|
63
|
+
ACCOUNT = 0,
|
64
|
+
TRUSTLINE = 1,
|
65
|
+
OFFER = 2
|
66
|
+
};
|
67
|
+
|
68
|
+
struct Signer
|
69
|
+
{
|
70
|
+
AccountID pubKey;
|
71
|
+
uint32 weight; // really only need 1byte
|
72
|
+
};
|
73
|
+
|
74
|
+
enum AccountFlags
|
75
|
+
{ // masks for each flag
|
76
|
+
|
77
|
+
// if set, TrustLines are created with authorized set to "false"
|
78
|
+
// requiring the issuer to set it for each TrustLine
|
79
|
+
AUTH_REQUIRED_FLAG = 0x1,
|
80
|
+
// if set, the authorized flag in TrustLines can be cleared
|
81
|
+
// otherwise, authorization cannot be revoked
|
82
|
+
AUTH_REVOCABLE_FLAG = 0x2
|
83
|
+
};
|
84
|
+
|
85
|
+
/* AccountEntry
|
86
|
+
|
87
|
+
Main entry representing a user in Stellar. All transactions are
|
88
|
+
performed using an account.
|
89
|
+
|
90
|
+
Other ledger entries created require an account.
|
91
|
+
|
92
|
+
*/
|
93
|
+
|
94
|
+
struct AccountEntry
|
95
|
+
{
|
96
|
+
AccountID accountID; // master public key for this account
|
97
|
+
int64 balance; // in stroops
|
98
|
+
SequenceNumber seqNum; // last sequence number used for this account
|
99
|
+
uint32 numSubEntries; // number of sub-entries this account has
|
100
|
+
// drives the reserve
|
101
|
+
AccountID* inflationDest; // Account to vote for during inflation
|
102
|
+
uint32 flags; // see AccountFlags
|
103
|
+
|
104
|
+
string32 homeDomain; // can be used for reverse federation and memo lookup
|
105
|
+
|
106
|
+
// fields used for signatures
|
107
|
+
// thresholds stores unsigned bytes: [weight of master|low|medium|high]
|
108
|
+
Thresholds thresholds;
|
109
|
+
|
110
|
+
Signer signers<20>; // possible signers for this account
|
111
|
+
|
112
|
+
// reserved for future use
|
113
|
+
union switch (int v)
|
114
|
+
{
|
115
|
+
case 0:
|
116
|
+
void;
|
117
|
+
}
|
118
|
+
ext;
|
119
|
+
};
|
120
|
+
|
121
|
+
/* TrustLineEntry
|
122
|
+
A trust line represents a specific trust relationship with
|
123
|
+
a credit/issuer (limit, authorization)
|
124
|
+
as well as the balance.
|
125
|
+
*/
|
126
|
+
|
127
|
+
enum TrustLineFlags
|
128
|
+
{
|
129
|
+
// issuer has authorized account to perform transactions with its credit
|
130
|
+
AUTHORIZED_FLAG = 1
|
131
|
+
};
|
132
|
+
|
133
|
+
struct TrustLineEntry
|
134
|
+
{
|
135
|
+
AccountID accountID; // account this trustline belongs to
|
136
|
+
Asset asset; // type of asset (with issuer)
|
137
|
+
int64 balance; // how much of this asset the user has.
|
138
|
+
// Asset defines the unit for this;
|
139
|
+
|
140
|
+
int64 limit; // balance cannot be above this
|
141
|
+
uint32 flags; // see TrustLineFlags
|
142
|
+
|
143
|
+
// reserved for future use
|
144
|
+
union switch (int v)
|
145
|
+
{
|
146
|
+
case 0:
|
147
|
+
void;
|
148
|
+
}
|
149
|
+
ext;
|
150
|
+
};
|
151
|
+
|
152
|
+
enum OfferEntryFlags
|
153
|
+
{
|
154
|
+
// issuer has authorized account to perform transactions with its credit
|
155
|
+
PASSIVE_FLAG = 1
|
156
|
+
};
|
157
|
+
|
158
|
+
/* OfferEntry
|
159
|
+
An offer is the building block of the offer book, they are automatically
|
160
|
+
claimed by payments when the price set by the owner is met.
|
161
|
+
|
162
|
+
For example an Offer is selling 10A where 1A is priced at 1.5B
|
163
|
+
|
164
|
+
*/
|
165
|
+
struct OfferEntry
|
166
|
+
{
|
167
|
+
AccountID sellerID;
|
168
|
+
uint64 offerID;
|
169
|
+
Asset selling; // A
|
170
|
+
Asset buying; // B
|
171
|
+
int64 amount; // amount of A
|
172
|
+
|
173
|
+
/* price for this offer:
|
174
|
+
price of A in terms of B
|
175
|
+
price=AmountB/AmountA=priceNumerator/priceDenominator
|
176
|
+
price is after fees
|
177
|
+
*/
|
178
|
+
Price price;
|
179
|
+
uint32 flags; // see OfferEntryFlags
|
180
|
+
|
181
|
+
// reserved for future use
|
182
|
+
union switch (int v)
|
183
|
+
{
|
184
|
+
case 0:
|
185
|
+
void;
|
186
|
+
}
|
187
|
+
ext;
|
188
|
+
};
|
189
|
+
|
190
|
+
struct LedgerEntry
|
191
|
+
{
|
192
|
+
uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
|
193
|
+
|
194
|
+
union switch (LedgerEntryType type)
|
195
|
+
{
|
196
|
+
case ACCOUNT:
|
197
|
+
AccountEntry account;
|
198
|
+
case TRUSTLINE:
|
199
|
+
TrustLineEntry trustLine;
|
200
|
+
case OFFER:
|
201
|
+
OfferEntry offer;
|
202
|
+
}
|
203
|
+
data;
|
204
|
+
|
205
|
+
// reserved for future use
|
206
|
+
union switch (int v)
|
207
|
+
{
|
208
|
+
case 0:
|
209
|
+
void;
|
210
|
+
}
|
211
|
+
ext;
|
212
|
+
};
|
213
|
+
|
214
|
+
// list of all envelope types used in the application
|
215
|
+
// those are prefixes used when building signatures for
|
216
|
+
// the respective envelopes
|
217
|
+
enum EnvelopeType
|
218
|
+
{
|
219
|
+
ENVELOPE_TYPE_SCP = 1,
|
220
|
+
ENVELOPE_TYPE_TX = 2
|
221
|
+
};
|
222
|
+
}
|
@@ -0,0 +1,231 @@
|
|
1
|
+
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
|
2
|
+
// under the Apache License, Version 2.0. See the COPYING file at the root
|
3
|
+
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
|
5
|
+
%#include "xdr/Stellar-transaction.h"
|
6
|
+
|
7
|
+
namespace stellar
|
8
|
+
{
|
9
|
+
|
10
|
+
typedef opaque UpgradeType<128>;
|
11
|
+
|
12
|
+
/* StellarValue is the value used by SCP to reach consensus on a given ledger
|
13
|
+
*/
|
14
|
+
struct StellarValue
|
15
|
+
{
|
16
|
+
Hash txSetHash; // transaction set to apply to previous ledger
|
17
|
+
uint64 closeTime; // network close time
|
18
|
+
|
19
|
+
// upgrades to apply to the previous ledger (usually empty)
|
20
|
+
// this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
|
21
|
+
// unknown steps during consensus if needed.
|
22
|
+
// see notes below on 'LedgerUpgrade' for more detail
|
23
|
+
UpgradeType upgrades<4>;
|
24
|
+
|
25
|
+
// reserved for future use
|
26
|
+
union switch (int v)
|
27
|
+
{
|
28
|
+
case 0:
|
29
|
+
void;
|
30
|
+
}
|
31
|
+
ext;
|
32
|
+
};
|
33
|
+
|
34
|
+
/* The LedgerHeader is the highest level structure representing the
|
35
|
+
* state of a ledger, cryptographically linked to previous ledgers.
|
36
|
+
*/
|
37
|
+
struct LedgerHeader
|
38
|
+
{
|
39
|
+
uint32 ledgerVersion; // the protocol version of the ledger
|
40
|
+
Hash previousLedgerHash; // hash of the previous ledger header
|
41
|
+
StellarValue scpValue; // what consensus agreed to
|
42
|
+
Hash txSetResultHash; // the TransactionResultSet that led to this ledger
|
43
|
+
Hash bucketListHash; // hash of the ledger state
|
44
|
+
|
45
|
+
uint32 ledgerSeq; // sequence number of this ledger
|
46
|
+
|
47
|
+
int64 totalCoins; // total number of stroops in existence
|
48
|
+
|
49
|
+
int64 feePool; // fees burned since last inflation run
|
50
|
+
uint32 inflationSeq; // inflation sequence number
|
51
|
+
|
52
|
+
uint64 idPool; // last used global ID, used for generating objects
|
53
|
+
|
54
|
+
uint32 baseFee; // base fee per operation in stroops
|
55
|
+
uint32 baseReserve; // account base reserve in stroops
|
56
|
+
|
57
|
+
Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
|
58
|
+
// in time without walking the chain back ledger by ledger
|
59
|
+
// each slot contains the oldest ledger that is mod of
|
60
|
+
// either 50 5000 50000 or 500000 depending on index
|
61
|
+
// skipList[0] mod(50), skipList[1] mod(5000), etc
|
62
|
+
|
63
|
+
// reserved for future use
|
64
|
+
union switch (int v)
|
65
|
+
{
|
66
|
+
case 0:
|
67
|
+
void;
|
68
|
+
}
|
69
|
+
ext;
|
70
|
+
};
|
71
|
+
|
72
|
+
/* Ledger upgrades
|
73
|
+
note that the `upgrades` field from StellarValue is normalized such that
|
74
|
+
it only contains one entry per LedgerUpgradeType, and entries are sorted
|
75
|
+
in ascending order
|
76
|
+
*/
|
77
|
+
enum LedgerUpgradeType
|
78
|
+
{
|
79
|
+
LEDGER_UPGRADE_VERSION = 1,
|
80
|
+
LEDGER_UPGRADE_BASE_FEE = 2
|
81
|
+
};
|
82
|
+
|
83
|
+
union LedgerUpgrade switch (LedgerUpgradeType type)
|
84
|
+
{
|
85
|
+
case LEDGER_UPGRADE_VERSION:
|
86
|
+
uint32 newLedgerVersion; // update ledgerVersion
|
87
|
+
case LEDGER_UPGRADE_BASE_FEE:
|
88
|
+
uint32 newBaseFee; // update baseFee
|
89
|
+
};
|
90
|
+
|
91
|
+
/* Entries used to define the bucket list */
|
92
|
+
|
93
|
+
union LedgerKey switch (LedgerEntryType type)
|
94
|
+
{
|
95
|
+
case ACCOUNT:
|
96
|
+
struct
|
97
|
+
{
|
98
|
+
AccountID accountID;
|
99
|
+
} account;
|
100
|
+
|
101
|
+
case TRUSTLINE:
|
102
|
+
struct
|
103
|
+
{
|
104
|
+
AccountID accountID;
|
105
|
+
Asset asset;
|
106
|
+
} trustLine;
|
107
|
+
|
108
|
+
case OFFER:
|
109
|
+
struct
|
110
|
+
{
|
111
|
+
AccountID sellerID;
|
112
|
+
uint64 offerID;
|
113
|
+
} offer;
|
114
|
+
};
|
115
|
+
|
116
|
+
enum BucketEntryType
|
117
|
+
{
|
118
|
+
LIVEENTRY = 0,
|
119
|
+
DEADENTRY = 1
|
120
|
+
};
|
121
|
+
|
122
|
+
union BucketEntry switch (BucketEntryType type)
|
123
|
+
{
|
124
|
+
case LIVEENTRY:
|
125
|
+
LedgerEntry liveEntry;
|
126
|
+
|
127
|
+
case DEADENTRY:
|
128
|
+
LedgerKey deadEntry;
|
129
|
+
};
|
130
|
+
|
131
|
+
// Transaction sets are the unit used by SCP to decide on transitions
|
132
|
+
// between ledgers
|
133
|
+
const MAX_TX_PER_LEDGER = 5000;
|
134
|
+
struct TransactionSet
|
135
|
+
{
|
136
|
+
Hash previousLedgerHash;
|
137
|
+
TransactionEnvelope txs<MAX_TX_PER_LEDGER>;
|
138
|
+
};
|
139
|
+
|
140
|
+
struct TransactionResultPair
|
141
|
+
{
|
142
|
+
Hash transactionHash;
|
143
|
+
TransactionResult result; // result for the transaction
|
144
|
+
};
|
145
|
+
|
146
|
+
// TransactionResultSet is used to recover results between ledgers
|
147
|
+
struct TransactionResultSet
|
148
|
+
{
|
149
|
+
TransactionResultPair results<MAX_TX_PER_LEDGER>;
|
150
|
+
};
|
151
|
+
|
152
|
+
// Entries below are used in the historical subsystem
|
153
|
+
|
154
|
+
struct TransactionHistoryEntry
|
155
|
+
{
|
156
|
+
uint32 ledgerSeq;
|
157
|
+
TransactionSet txSet;
|
158
|
+
|
159
|
+
// reserved for future use
|
160
|
+
union switch (int v)
|
161
|
+
{
|
162
|
+
case 0:
|
163
|
+
void;
|
164
|
+
}
|
165
|
+
ext;
|
166
|
+
};
|
167
|
+
|
168
|
+
struct TransactionHistoryResultEntry
|
169
|
+
{
|
170
|
+
uint32 ledgerSeq;
|
171
|
+
TransactionResultSet txResultSet;
|
172
|
+
|
173
|
+
// reserved for future use
|
174
|
+
union switch (int v)
|
175
|
+
{
|
176
|
+
case 0:
|
177
|
+
void;
|
178
|
+
}
|
179
|
+
ext;
|
180
|
+
};
|
181
|
+
|
182
|
+
struct LedgerHeaderHistoryEntry
|
183
|
+
{
|
184
|
+
Hash hash;
|
185
|
+
LedgerHeader header;
|
186
|
+
|
187
|
+
// reserved for future use
|
188
|
+
union switch (int v)
|
189
|
+
{
|
190
|
+
case 0:
|
191
|
+
void;
|
192
|
+
}
|
193
|
+
ext;
|
194
|
+
};
|
195
|
+
|
196
|
+
// represents the meta in the transaction table history
|
197
|
+
|
198
|
+
enum LedgerEntryChangeType
|
199
|
+
{
|
200
|
+
LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
|
201
|
+
LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
|
202
|
+
LEDGER_ENTRY_REMOVED = 2 // entry was removed from the ledger
|
203
|
+
};
|
204
|
+
|
205
|
+
union LedgerEntryChange switch (LedgerEntryChangeType type)
|
206
|
+
{
|
207
|
+
case LEDGER_ENTRY_CREATED:
|
208
|
+
LedgerEntry created;
|
209
|
+
case LEDGER_ENTRY_UPDATED:
|
210
|
+
LedgerEntry updated;
|
211
|
+
case LEDGER_ENTRY_REMOVED:
|
212
|
+
LedgerKey removed;
|
213
|
+
};
|
214
|
+
|
215
|
+
typedef LedgerEntryChange LedgerEntryChanges<>;
|
216
|
+
|
217
|
+
struct OperationMeta
|
218
|
+
{
|
219
|
+
LedgerEntryChanges changes;
|
220
|
+
};
|
221
|
+
|
222
|
+
union TransactionMeta switch (int v)
|
223
|
+
{
|
224
|
+
case 0:
|
225
|
+
struct
|
226
|
+
{
|
227
|
+
LedgerEntryChanges changes;
|
228
|
+
OperationMeta operations<>;
|
229
|
+
} v0;
|
230
|
+
};
|
231
|
+
}
|