stellar-base 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +15 -0
- data/.yardopts +8 -0
- data/Gemfile +15 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +202 -0
- data/README.md +79 -0
- data/Rakefile +6 -0
- data/examples/low_level_transaction_post.rb +53 -0
- data/examples/mid_level_transaction_post.rb +34 -0
- data/examples/non_native_payment.rb +60 -0
- data/generated/stellar/account_entry.rb +37 -0
- data/generated/stellar/account_flags.rb +20 -0
- data/generated/stellar/account_merge_result.rb +25 -0
- data/generated/stellar/account_merge_result_code.rb +30 -0
- data/generated/stellar/allow_trust_op/currency.rb +28 -0
- data/generated/stellar/allow_trust_op.rb +35 -0
- data/generated/stellar/allow_trust_result.rb +25 -0
- data/generated/stellar/allow_trust_result_code.rb +28 -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 +28 -0
- data/generated/stellar/claim_offer_atom.rb +29 -0
- data/generated/stellar/create_offer_effect.rb +24 -0
- data/generated/stellar/create_offer_op.rb +28 -0
- data/generated/stellar/create_offer_result.rb +26 -0
- data/generated/stellar/create_offer_result_code.rb +45 -0
- data/generated/stellar/create_offer_success_result/offer.rb +30 -0
- data/generated/stellar/create_offer_success_result.rb +34 -0
- data/generated/stellar/currency.rb +29 -0
- data/generated/stellar/currency_type.rb +22 -0
- data/generated/stellar/decorated_signature.rb +20 -0
- data/generated/stellar/dont_have.rb +20 -0
- data/generated/stellar/error.rb +20 -0
- data/generated/stellar/hello.rb +24 -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/iso_currency_issuer.rb +20 -0
- data/generated/stellar/ledger_entry.rb +33 -0
- data/generated/stellar/ledger_entry_type.rb +24 -0
- data/generated/stellar/ledger_header.rb +45 -0
- data/generated/stellar/ledger_header_history_entry.rb +20 -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_key.rb +50 -0
- data/generated/stellar/message_type.rb +45 -0
- data/generated/stellar/offer_entry.rb +34 -0
- data/generated/stellar/operation/body.rb +49 -0
- data/generated/stellar/operation.rb +45 -0
- data/generated/stellar/operation_result/tr.rb +49 -0
- data/generated/stellar/operation_result.rb +47 -0
- data/generated/stellar/operation_result_code.rb +25 -0
- data/generated/stellar/operation_type.rb +32 -0
- data/generated/stellar/payment_op.rb +35 -0
- data/generated/stellar/payment_result.rb +29 -0
- data/generated/stellar/payment_result_code.rb +41 -0
- data/generated/stellar/payment_success_multi_result.rb +20 -0
- data/generated/stellar/peer_address.rb +22 -0
- data/generated/stellar/price.rb +20 -0
- data/generated/stellar/scp_ballot.rb +20 -0
- data/generated/stellar/scp_envelope.rb +22 -0
- data/generated/stellar/scp_quorum_set.rb +20 -0
- data/generated/stellar/scp_statement/pledges/prepare.rb +24 -0
- data/generated/stellar/scp_statement/pledges.rb +40 -0
- data/generated/stellar/scp_statement.rb +42 -0
- data/generated/stellar/scp_statement_type.rb +26 -0
- data/generated/stellar/set_options_op.rb +31 -0
- data/generated/stellar/set_options_result.rb +25 -0
- data/generated/stellar/set_options_result_code.rb +28 -0
- data/generated/stellar/signer.rb +20 -0
- data/generated/stellar/simple_payment_result.rb +22 -0
- data/generated/stellar/stellar_ballot.rb +22 -0
- data/generated/stellar/stellar_ballot_value.rb +22 -0
- data/generated/stellar/stellar_message.rb +66 -0
- data/generated/stellar/transaction.rb +37 -0
- data/generated/stellar/transaction_envelope.rb +20 -0
- data/generated/stellar/transaction_history_entry.rb +20 -0
- data/generated/stellar/transaction_history_result_entry.rb +20 -0
- data/generated/stellar/transaction_meta.rb +18 -0
- data/generated/stellar/transaction_result/result.rb +30 -0
- data/generated/stellar/transaction_result.rb +33 -0
- data/generated/stellar/transaction_result_code.rb +46 -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 +28 -0
- data/generated/stellar-base-generated.rb +160 -0
- data/lib/stellar/base/version.rb +5 -0
- data/lib/stellar/base.rb +1 -0
- data/lib/stellar/change_trust_op.rb +10 -0
- data/lib/stellar/currency.rb +28 -0
- data/lib/stellar/key_pair.rb +94 -0
- data/lib/stellar/payment_op.rb +38 -0
- data/lib/stellar/transaction.rb +72 -0
- data/lib/stellar/transaction_envelope.rb +32 -0
- data/lib/stellar/util/base58.rb +127 -0
- data/lib/stellar-base.rb +23 -0
- data/ruby-stellar-base.gemspec +34 -0
- data/spec/lib/stellar/key_pair_spec.rb +199 -0
- data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
- data/spec/lib/stellar/transaction_spec.rb +43 -0
- data/spec/lib/stellar/util/base58_spec.rb +74 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/matchers/be_base58_check.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 +9 -0
- data/tasks/xdr.rake +48 -0
- data/xdr/SCPXDR.x +61 -0
- data/xdr/Stellar-ledger-entries.x +105 -0
- data/xdr/Stellar-ledger.x +117 -0
- data/xdr/Stellar-overlay.x +100 -0
- data/xdr/Stellar-transaction.x +497 -0
- data/xdr/Stellar-types.x +53 -0
- data/xdr/StellarXDR.x +11 -0
- metadata +342 -0
data/tasks/xdr.rake
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
namespace :xdr do
|
|
2
|
+
|
|
3
|
+
# As Hayashi adds more .x files, we'll need to update this array
|
|
4
|
+
# Prior to launch, we should be separating our .x files into a separate
|
|
5
|
+
# repo, and should be able to improve this integration.
|
|
6
|
+
HAYASHI_XDR = [
|
|
7
|
+
"src/xdr/Stellar-ledger-entries.x",
|
|
8
|
+
"src/xdr/Stellar-ledger.x",
|
|
9
|
+
"src/xdr/Stellar-overlay.x",
|
|
10
|
+
"src/xdr/Stellar-transaction.x",
|
|
11
|
+
"src/xdr/Stellar-types.x",
|
|
12
|
+
"src/overlay/StellarXDR.x",
|
|
13
|
+
"src/scp/SCPXDR.x",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
task :update => [:download, :generate]
|
|
17
|
+
|
|
18
|
+
task :download do
|
|
19
|
+
require 'octokit'
|
|
20
|
+
require 'base64'
|
|
21
|
+
|
|
22
|
+
client = Octokit::Client.new(:netrc => true)
|
|
23
|
+
|
|
24
|
+
HAYASHI_XDR.each do |src|
|
|
25
|
+
local_path = "xdr/" + File.basename(src)
|
|
26
|
+
encoded = client.contents("stellar/stellar-core", path: src).content
|
|
27
|
+
decoded = Base64.decode64 encoded
|
|
28
|
+
|
|
29
|
+
IO.write(local_path, decoded)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
task :generate do
|
|
34
|
+
require "pathname"
|
|
35
|
+
require "xdrgen"
|
|
36
|
+
require 'fileutils'
|
|
37
|
+
FileUtils.rm_rf "generated"
|
|
38
|
+
|
|
39
|
+
paths = Pathname.glob("xdr/**/*.x")
|
|
40
|
+
compilation = Xdrgen::Compilation.new(
|
|
41
|
+
paths,
|
|
42
|
+
output_dir: "generated",
|
|
43
|
+
namespace: "stellar-base-generated",
|
|
44
|
+
language: :ruby
|
|
45
|
+
)
|
|
46
|
+
compilation.compile
|
|
47
|
+
end
|
|
48
|
+
end
|
data/xdr/SCPXDR.x
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
namespace stellar
|
|
3
|
+
{
|
|
4
|
+
|
|
5
|
+
typedef opaque Signature[64];
|
|
6
|
+
typedef opaque Hash[32];
|
|
7
|
+
typedef opaque uint256[32];
|
|
8
|
+
typedef unsigned int uint32;
|
|
9
|
+
typedef unsigned hyper uint64;
|
|
10
|
+
typedef opaque Value<>;
|
|
11
|
+
typedef opaque Evidence<>;
|
|
12
|
+
|
|
13
|
+
struct SCPBallot
|
|
14
|
+
{
|
|
15
|
+
uint32 counter; // n
|
|
16
|
+
Value value; // x
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
enum SCPStatementType
|
|
20
|
+
{
|
|
21
|
+
PREPARING = 0,
|
|
22
|
+
PREPARED = 1,
|
|
23
|
+
COMMITTING = 2,
|
|
24
|
+
COMMITTED = 3
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
struct SCPStatement
|
|
28
|
+
{
|
|
29
|
+
uint64 slotIndex; // i
|
|
30
|
+
SCPBallot ballot; // b
|
|
31
|
+
Hash quorumSetHash; // D
|
|
32
|
+
|
|
33
|
+
union switch (SCPStatementType type)
|
|
34
|
+
{
|
|
35
|
+
case PREPARING:
|
|
36
|
+
struct
|
|
37
|
+
{
|
|
38
|
+
SCPBallot excepted<>; // B_c
|
|
39
|
+
SCPBallot* prepared; // p
|
|
40
|
+
} prepare;
|
|
41
|
+
case PREPARED:
|
|
42
|
+
case COMMITTING:
|
|
43
|
+
case COMMITTED:
|
|
44
|
+
void;
|
|
45
|
+
}
|
|
46
|
+
pledges;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
struct SCPEnvelope
|
|
50
|
+
{
|
|
51
|
+
uint256 nodeID; // v
|
|
52
|
+
SCPStatement statement;
|
|
53
|
+
Signature signature;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
struct SCPQuorumSet
|
|
57
|
+
{
|
|
58
|
+
uint32 threshold;
|
|
59
|
+
Hash validators<>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 "generated/Stellar-types.h"
|
|
6
|
+
|
|
7
|
+
namespace stellar
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
enum LedgerEntryType
|
|
11
|
+
{
|
|
12
|
+
ACCOUNT = 0,
|
|
13
|
+
TRUSTLINE = 1,
|
|
14
|
+
OFFER = 2
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
struct Signer
|
|
18
|
+
{
|
|
19
|
+
uint256 pubKey;
|
|
20
|
+
uint32 weight; // really only need 1byte
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
enum AccountFlags
|
|
24
|
+
{ // masks for each flag
|
|
25
|
+
AUTH_REQUIRED_FLAG = 0x1
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/* AccountEntry
|
|
29
|
+
|
|
30
|
+
Main entry representing a user in Stellar. All transactions are performed
|
|
31
|
+
using an account.
|
|
32
|
+
|
|
33
|
+
Other ledger entries created require an account.
|
|
34
|
+
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
struct AccountEntry
|
|
38
|
+
{
|
|
39
|
+
AccountID accountID; // master public key for this account
|
|
40
|
+
int64 balance; // in stroops
|
|
41
|
+
SequenceNumber seqNum; // last sequence number used for this account
|
|
42
|
+
uint32 numSubEntries; // number of sub-entries this account has
|
|
43
|
+
// drives the reserve
|
|
44
|
+
AccountID* inflationDest; // Account to vote during inflation
|
|
45
|
+
uint32 flags; // see AccountFlags
|
|
46
|
+
|
|
47
|
+
// fields used for signatures
|
|
48
|
+
// thresholds stores unsigned bytes: [weight of master|low|medium|high]
|
|
49
|
+
Thresholds thresholds;
|
|
50
|
+
|
|
51
|
+
Signer signers<20>; // possible signers for this account
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/* TrustLineEntry
|
|
55
|
+
A trust line represents a specific trust relationship with
|
|
56
|
+
a currency/issuer (limit, authorization)
|
|
57
|
+
as well as the balance.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
struct TrustLineEntry
|
|
61
|
+
{
|
|
62
|
+
AccountID accountID; // account this trustline belongs to
|
|
63
|
+
Currency currency; // currency (with issuer)
|
|
64
|
+
int64 balance; // how much of this currency the user has.
|
|
65
|
+
// Currency defines the unit for this;
|
|
66
|
+
|
|
67
|
+
int64 limit; // balance cannot be above this
|
|
68
|
+
bool authorized; // issuer has authorized account to hold its credit
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/* OfferEntry
|
|
72
|
+
An offer is the building block of the offer book, they are automatically
|
|
73
|
+
claimed by payments when the price set by the owner is met.
|
|
74
|
+
|
|
75
|
+
For example an Offer is selling 10A where 1A is priced at 1.5B
|
|
76
|
+
|
|
77
|
+
*/
|
|
78
|
+
struct OfferEntry
|
|
79
|
+
{
|
|
80
|
+
AccountID accountID;
|
|
81
|
+
uint64 offerID;
|
|
82
|
+
Currency takerGets; // A
|
|
83
|
+
Currency takerPays; // B
|
|
84
|
+
int64 amount; // amount of A
|
|
85
|
+
|
|
86
|
+
/* price for this offer:
|
|
87
|
+
price of A in terms of B
|
|
88
|
+
price=AmountB/AmountA=priceNumerator/priceDenominator
|
|
89
|
+
price is after fees
|
|
90
|
+
*/
|
|
91
|
+
Price price;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
union LedgerEntry switch (LedgerEntryType type)
|
|
95
|
+
{
|
|
96
|
+
case ACCOUNT:
|
|
97
|
+
AccountEntry account;
|
|
98
|
+
|
|
99
|
+
case TRUSTLINE:
|
|
100
|
+
TrustLineEntry trustLine;
|
|
101
|
+
|
|
102
|
+
case OFFER:
|
|
103
|
+
OfferEntry offer;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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 "generated/Stellar-transaction.h"
|
|
6
|
+
|
|
7
|
+
namespace stellar
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
/* The LedgerHeader is the highest level structure representing the
|
|
11
|
+
* state of a ledger, cryptographically linked to previous ledgers.
|
|
12
|
+
*/
|
|
13
|
+
struct LedgerHeader
|
|
14
|
+
{
|
|
15
|
+
Hash previousLedgerHash; // hash of the previous ledger header
|
|
16
|
+
Hash txSetHash; // the tx set that was SCP confirmed
|
|
17
|
+
Hash txSetResultHash; // the TransactionResultSet that led to this ledger
|
|
18
|
+
Hash bucketListHash; // hash of the ledger state
|
|
19
|
+
|
|
20
|
+
uint32 ledgerSeq; // sequence number of this ledger
|
|
21
|
+
uint64 closeTime; // network close time
|
|
22
|
+
|
|
23
|
+
int64 totalCoins; // total number of stroops in existence
|
|
24
|
+
|
|
25
|
+
int64 feePool; // fees burned since last inflation run
|
|
26
|
+
uint32 inflationSeq; // inflation sequence number
|
|
27
|
+
|
|
28
|
+
uint64 idPool; // last used global ID, used for generating objects
|
|
29
|
+
|
|
30
|
+
int32 baseFee; // base fee per operation in stroops
|
|
31
|
+
int32 baseReserve; // account base reserve in stroops
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* Entries used to define the bucket list */
|
|
35
|
+
|
|
36
|
+
union LedgerKey switch (LedgerEntryType type)
|
|
37
|
+
{
|
|
38
|
+
case ACCOUNT:
|
|
39
|
+
struct
|
|
40
|
+
{
|
|
41
|
+
AccountID accountID;
|
|
42
|
+
} account;
|
|
43
|
+
|
|
44
|
+
case TRUSTLINE:
|
|
45
|
+
struct
|
|
46
|
+
{
|
|
47
|
+
AccountID accountID;
|
|
48
|
+
Currency currency;
|
|
49
|
+
} trustLine;
|
|
50
|
+
|
|
51
|
+
case OFFER:
|
|
52
|
+
struct
|
|
53
|
+
{
|
|
54
|
+
AccountID accountID;
|
|
55
|
+
uint64 offerID;
|
|
56
|
+
} offer;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
enum BucketEntryType
|
|
60
|
+
{
|
|
61
|
+
LIVEENTRY = 0,
|
|
62
|
+
DEADENTRY = 1
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
union BucketEntry switch (BucketEntryType type)
|
|
66
|
+
{
|
|
67
|
+
case LIVEENTRY:
|
|
68
|
+
LedgerEntry liveEntry;
|
|
69
|
+
|
|
70
|
+
case DEADENTRY:
|
|
71
|
+
LedgerKey deadEntry;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Transaction sets are the unit used by SCP to decide on transitions
|
|
75
|
+
// between ledgers
|
|
76
|
+
struct TransactionSet
|
|
77
|
+
{
|
|
78
|
+
Hash previousLedgerHash;
|
|
79
|
+
TransactionEnvelope txs<5000>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
struct TransactionResultPair
|
|
83
|
+
{
|
|
84
|
+
Hash transactionHash;
|
|
85
|
+
TransactionResult result; // result for the transaction
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// TransactionResultSet is used to recover results between ledgers
|
|
89
|
+
struct TransactionResultSet
|
|
90
|
+
{
|
|
91
|
+
TransactionResultPair results<5000>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Entries below are used in the historical subsystem
|
|
95
|
+
struct TransactionMeta
|
|
96
|
+
{
|
|
97
|
+
BucketEntry entries<>;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
struct TransactionHistoryEntry
|
|
101
|
+
{
|
|
102
|
+
uint32 ledgerSeq;
|
|
103
|
+
TransactionSet txSet;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
struct TransactionHistoryResultEntry
|
|
107
|
+
{
|
|
108
|
+
uint32 ledgerSeq;
|
|
109
|
+
TransactionResultSet txResultSet;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
struct LedgerHeaderHistoryEntry
|
|
113
|
+
{
|
|
114
|
+
Hash hash;
|
|
115
|
+
LedgerHeader header;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 "generated/Stellar-ledger.h"
|
|
6
|
+
|
|
7
|
+
namespace stellar
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
struct StellarBallotValue
|
|
11
|
+
{
|
|
12
|
+
Hash txSetHash;
|
|
13
|
+
uint64 closeTime;
|
|
14
|
+
uint32 baseFee;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
struct StellarBallot
|
|
18
|
+
{
|
|
19
|
+
uint256 nodeID;
|
|
20
|
+
Signature signature;
|
|
21
|
+
StellarBallotValue value;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct Error
|
|
25
|
+
{
|
|
26
|
+
int code;
|
|
27
|
+
string msg<100>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct Hello
|
|
31
|
+
{
|
|
32
|
+
int protocolVersion;
|
|
33
|
+
string versionStr<100>;
|
|
34
|
+
int listeningPort;
|
|
35
|
+
opaque peerID[32];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
struct PeerAddress
|
|
39
|
+
{
|
|
40
|
+
opaque ip[4];
|
|
41
|
+
uint32 port;
|
|
42
|
+
uint32 numFailures;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
enum MessageType
|
|
46
|
+
{
|
|
47
|
+
ERROR_MSG = 0,
|
|
48
|
+
HELLO = 1,
|
|
49
|
+
DONT_HAVE = 2,
|
|
50
|
+
|
|
51
|
+
GET_PEERS = 3, // gets a list of peers this guy knows about
|
|
52
|
+
PEERS = 4,
|
|
53
|
+
|
|
54
|
+
GET_TX_SET = 5, // gets a particular txset by hash
|
|
55
|
+
TX_SET = 6,
|
|
56
|
+
|
|
57
|
+
TRANSACTION = 7, // pass on a tx you have heard about
|
|
58
|
+
|
|
59
|
+
// SCP
|
|
60
|
+
GET_SCP_QUORUMSET = 8,
|
|
61
|
+
SCP_QUORUMSET = 9,
|
|
62
|
+
SCP_MESSAGE = 10
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
struct DontHave
|
|
66
|
+
{
|
|
67
|
+
MessageType type;
|
|
68
|
+
uint256 reqHash;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
union StellarMessage switch (MessageType type)
|
|
72
|
+
{
|
|
73
|
+
case ERROR_MSG:
|
|
74
|
+
Error error;
|
|
75
|
+
case HELLO:
|
|
76
|
+
Hello hello;
|
|
77
|
+
case DONT_HAVE:
|
|
78
|
+
DontHave dontHave;
|
|
79
|
+
case GET_PEERS:
|
|
80
|
+
void;
|
|
81
|
+
case PEERS:
|
|
82
|
+
PeerAddress peers<>;
|
|
83
|
+
|
|
84
|
+
case GET_TX_SET:
|
|
85
|
+
uint256 txSetHash;
|
|
86
|
+
case TX_SET:
|
|
87
|
+
TransactionSet txSet;
|
|
88
|
+
|
|
89
|
+
case TRANSACTION:
|
|
90
|
+
TransactionEnvelope transaction;
|
|
91
|
+
|
|
92
|
+
// SCP
|
|
93
|
+
case GET_SCP_QUORUMSET:
|
|
94
|
+
uint256 qSetHash;
|
|
95
|
+
case SCP_QUORUMSET:
|
|
96
|
+
SCPQuorumSet qSet;
|
|
97
|
+
case SCP_MESSAGE:
|
|
98
|
+
SCPEnvelope envelope;
|
|
99
|
+
};
|
|
100
|
+
}
|