mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
ASCII clean
This commit is contained in:
committed by
Vinnie Falco
parent
295c8de858
commit
0f409b7bec
@@ -1,9 +1,9 @@
|
||||
# src
|
||||
|
||||
Some of these directories come from entire outside repositories
|
||||
brought in using git-subtree. This means that the source files are
|
||||
inserted directly into the rippled repository. They can be edited
|
||||
and committed just as if they were normal files.
|
||||
Some of these directories come from entire outside repositories brought in
|
||||
using git-subtree. This means that the source files are inserted directly
|
||||
into the rippled repository. They can be edited and committed just as if they
|
||||
were normal files.
|
||||
|
||||
However, if you create a commit that contains files both from a
|
||||
subtree, and from the ripple source tree please use care when designing
|
||||
|
||||
@@ -104,7 +104,9 @@ std::string DoSustain (std::string logFile)
|
||||
rename ("core", boost::str (boost::format ("core.%d") % static_cast<int> (pChild)).c_str ());
|
||||
if (!logFile.empty()) // FIXME: logFile hasn't been set yet
|
||||
rename (logFile.c_str(),
|
||||
boost::str (boost::format ("%s.%d") % logFile % static_cast<int> (pChild)).c_str ());
|
||||
boost::str (boost::format ("%s.%d")
|
||||
% logFile
|
||||
% static_cast<int> (pChild)).c_str ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,36 +27,36 @@ const char* TxnDBInit[] =
|
||||
"PRAGMA journal_size_limit=1582080;",
|
||||
|
||||
#if (ULONG_MAX > UINT_MAX) && !defined (NO_SQLITE_MMAP)
|
||||
"PRAGMA mmap_size=17179869184;",
|
||||
"PRAGMA mmap_size=17179869184;",
|
||||
#endif
|
||||
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE Transactions ( \
|
||||
TransID CHARACTER(64) PRIMARY KEY, \
|
||||
TransType CHARACTER(24), \
|
||||
FromAcct CHARACTER(35), \
|
||||
FromSeq BIGINT UNSIGNED, \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
Status CHARACTER(1), \
|
||||
RawTxn BLOB, \
|
||||
TxnMeta BLOB \
|
||||
);",
|
||||
"CREATE TABLE Transactions ( \
|
||||
TransID CHARACTER(64) PRIMARY KEY, \
|
||||
TransType CHARACTER(24), \
|
||||
FromAcct CHARACTER(35), \
|
||||
FromSeq BIGINT UNSIGNED, \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
Status CHARACTER(1), \
|
||||
RawTxn BLOB, \
|
||||
TxnMeta BLOB \
|
||||
);",
|
||||
"CREATE INDEX TxLgrIndex ON \
|
||||
Transactions(LedgerSeq);",
|
||||
Transactions(LedgerSeq);",
|
||||
|
||||
"CREATE TABLE AccountTransactions ( \
|
||||
TransID CHARACTER(64), \
|
||||
Account CHARACTER(64), \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
TxnSeq INTEGER \
|
||||
);",
|
||||
"CREATE INDEX AcctTxIDIndex ON \
|
||||
AccountTransactions(TransID);",
|
||||
"CREATE INDEX AcctTxIndex ON \
|
||||
AccountTransactions(Account, LedgerSeq, TxnSeq, TransID);",
|
||||
"CREATE INDEX AcctLgrIndex ON \
|
||||
AccountTransactions(LedgerSeq, Account, TransID);",
|
||||
"CREATE TABLE AccountTransactions ( \
|
||||
TransID CHARACTER(64), \
|
||||
Account CHARACTER(64), \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
TxnSeq INTEGER \
|
||||
);",
|
||||
"CREATE INDEX AcctTxIDIndex ON \
|
||||
AccountTransactions(TransID);",
|
||||
"CREATE INDEX AcctTxIndex ON \
|
||||
AccountTransactions(Account, LedgerSeq, TxnSeq, TransID);",
|
||||
"CREATE INDEX AcctLgrIndex ON \
|
||||
AccountTransactions(LedgerSeq, Account, TransID);",
|
||||
|
||||
"END TRANSACTION;"
|
||||
};
|
||||
@@ -72,30 +72,30 @@ const char* LedgerDBInit[] =
|
||||
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE Ledgers ( \
|
||||
LedgerHash CHARACTER(64) PRIMARY KEY, \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
PrevHash CHARACTER(64), \
|
||||
TotalCoins BIGINT UNSIGNED, \
|
||||
ClosingTime BIGINT UNSIGNED, \
|
||||
PrevClosingTime BIGINT UNSIGNED, \
|
||||
CloseTimeRes BIGINT UNSIGNED, \
|
||||
CloseFlags BIGINT UNSIGNED, \
|
||||
AccountSetHash CHARACTER(64), \
|
||||
TransSetHash CHARACTER(64) \
|
||||
);",
|
||||
"CREATE TABLE Ledgers ( \
|
||||
LedgerHash CHARACTER(64) PRIMARY KEY, \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
PrevHash CHARACTER(64), \
|
||||
TotalCoins BIGINT UNSIGNED, \
|
||||
ClosingTime BIGINT UNSIGNED, \
|
||||
PrevClosingTime BIGINT UNSIGNED, \
|
||||
CloseTimeRes BIGINT UNSIGNED, \
|
||||
CloseFlags BIGINT UNSIGNED, \
|
||||
AccountSetHash CHARACTER(64), \
|
||||
TransSetHash CHARACTER(64) \
|
||||
);",
|
||||
"CREATE INDEX SeqLedger ON Ledgers(LedgerSeq);",
|
||||
|
||||
"CREATE TABLE Validations ( \
|
||||
LedgerHash CHARACTER(64), \
|
||||
NodePubKey CHARACTER(56), \
|
||||
SignTime BIGINT UNSIGNED, \
|
||||
RawData BLOB \
|
||||
);",
|
||||
"CREATE INDEX ValidationsByHash ON \
|
||||
Validations(LedgerHash);",
|
||||
"CREATE INDEX ValidationsByTime ON \
|
||||
Validations(SignTime);",
|
||||
"CREATE TABLE Validations ( \
|
||||
LedgerHash CHARACTER(64), \
|
||||
NodePubKey CHARACTER(56), \
|
||||
SignTime BIGINT UNSIGNED, \
|
||||
RawData BLOB \
|
||||
);",
|
||||
"CREATE INDEX ValidationsByHash ON \
|
||||
Validations(LedgerHash);",
|
||||
"CREATE INDEX ValidationsByTime ON \
|
||||
Validations(SignTime);",
|
||||
|
||||
"END TRANSACTION;"
|
||||
};
|
||||
@@ -107,10 +107,10 @@ const char* RpcDBInit[] =
|
||||
{
|
||||
|
||||
// Local persistence of the RPC client
|
||||
"CREATE TABLE RPCData ( \
|
||||
Key TEXT PRIMARY Key, \
|
||||
Value TEXT \
|
||||
);",
|
||||
"CREATE TABLE RPCData ( \
|
||||
Key TEXT PRIMARY Key, \
|
||||
Value TEXT \
|
||||
);",
|
||||
};
|
||||
|
||||
int RpcDBCount = std::extent<decltype(RpcDBInit)>::value;
|
||||
@@ -123,22 +123,22 @@ const char* WalletDBInit[] =
|
||||
// Node identity must be persisted for CAS routing and responsibilities.
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE NodeIdentity ( \
|
||||
PublicKey CHARACTER(53), \
|
||||
PrivateKey CHARACTER(52), \
|
||||
Dh512 TEXT, \
|
||||
Dh1024 TEXT \
|
||||
);",
|
||||
"CREATE TABLE NodeIdentity ( \
|
||||
PublicKey CHARACTER(53), \
|
||||
PrivateKey CHARACTER(52), \
|
||||
Dh512 TEXT, \
|
||||
Dh1024 TEXT \
|
||||
);",
|
||||
|
||||
// Miscellaneous persistent information
|
||||
// Integer: 1 : Used to simplify SQL.
|
||||
// ScoreUpdated: when scores was last updated.
|
||||
// FetchUpdated: when last fetch succeeded.
|
||||
"CREATE TABLE Misc ( \
|
||||
Magic INTEGER UNIQUE NOT NULL, \
|
||||
ScoreUpdated DATETIME, \
|
||||
FetchUpdated DATETIME \
|
||||
);",
|
||||
"CREATE TABLE Misc ( \
|
||||
Magic INTEGER UNIQUE NOT NULL, \
|
||||
ScoreUpdated DATETIME, \
|
||||
FetchUpdated DATETIME \
|
||||
);",
|
||||
|
||||
// Scoring and other information for domains.
|
||||
//
|
||||
@@ -163,16 +163,16 @@ const char* WalletDBInit[] =
|
||||
// Comment:
|
||||
// User supplied comment.
|
||||
// Table of Domains user has asked to trust.
|
||||
"CREATE TABLE SeedDomains ( \
|
||||
Domain TEXT PRIMARY KEY NOT NULL, \
|
||||
PublicKey CHARACTER(53), \
|
||||
Source CHARACTER(1) NOT NULL, \
|
||||
Next DATETIME, \
|
||||
Scan DATETIME, \
|
||||
Fetch DATETIME, \
|
||||
Sha256 CHARACTER[64], \
|
||||
Comment TEXT \
|
||||
);",
|
||||
"CREATE TABLE SeedDomains ( \
|
||||
Domain TEXT PRIMARY KEY NOT NULL, \
|
||||
PublicKey CHARACTER(53), \
|
||||
Source CHARACTER(1) NOT NULL, \
|
||||
Next DATETIME, \
|
||||
Scan DATETIME, \
|
||||
Fetch DATETIME, \
|
||||
Sha256 CHARACTER[64], \
|
||||
Comment TEXT \
|
||||
);",
|
||||
|
||||
// Allow us to easily find the next SeedDomain to fetch.
|
||||
"CREATE INDEX SeedDomainNext ON SeedDomains (Next);",
|
||||
@@ -195,15 +195,15 @@ const char* WalletDBInit[] =
|
||||
// Checksum of last fetch.
|
||||
// Comment:
|
||||
// User supplied comment.
|
||||
"CREATE TABLE SeedNodes ( \
|
||||
PublicKey CHARACTER(53) PRIMARY KEY NOT NULL, \
|
||||
Source CHARACTER(1) NOT NULL, \
|
||||
Next DATETIME, \
|
||||
Scan DATETIME, \
|
||||
Fetch DATETIME, \
|
||||
Sha256 CHARACTER[64], \
|
||||
Comment TEXT \
|
||||
);",
|
||||
"CREATE TABLE SeedNodes ( \
|
||||
PublicKey CHARACTER(53) PRIMARY KEY NOT NULL, \
|
||||
Source CHARACTER(1) NOT NULL, \
|
||||
Next DATETIME, \
|
||||
Scan DATETIME, \
|
||||
Fetch DATETIME, \
|
||||
Sha256 CHARACTER[64], \
|
||||
Comment TEXT \
|
||||
);",
|
||||
|
||||
// Allow us to easily find the next SeedNode to fetch.
|
||||
"CREATE INDEX SeedNodeNext ON SeedNodes (Next);",
|
||||
@@ -215,12 +215,12 @@ const char* WalletDBInit[] =
|
||||
// Computed trust score. Higher is better.
|
||||
// Seen:
|
||||
// Last validation received.
|
||||
"CREATE TABLE TrustedNodes ( \
|
||||
PublicKey CHARACTER(53) PRIMARY KEY NOT NULL, \
|
||||
Score INTEGER DEFAULT 0 NOT NULL, \
|
||||
Seen DATETIME, \
|
||||
Comment TEXT \
|
||||
);",
|
||||
"CREATE TABLE TrustedNodes ( \
|
||||
PublicKey CHARACTER(53) PRIMARY KEY NOT NULL, \
|
||||
Score INTEGER DEFAULT 0 NOT NULL, \
|
||||
Seen DATETIME, \
|
||||
Comment TEXT \
|
||||
);",
|
||||
|
||||
// List of referrals.
|
||||
// - There may be multiple sources for a Validator. The last source is used.
|
||||
@@ -233,12 +233,12 @@ const char* WalletDBInit[] =
|
||||
// - Public key for CAS based referral.
|
||||
// - Domain for domain based referral.
|
||||
// XXX Do garbage collection when validators have no references.
|
||||
"CREATE TABLE ValidatorReferrals ( \
|
||||
Validator CHARACTER(53) NOT NULL, \
|
||||
Entry INTEGER NOT NULL, \
|
||||
Referral TEXT NOT NULL, \
|
||||
PRIMARY KEY (Validator,Entry) \
|
||||
);",
|
||||
"CREATE TABLE ValidatorReferrals ( \
|
||||
Validator CHARACTER(53) NOT NULL, \
|
||||
Entry INTEGER NOT NULL, \
|
||||
Referral TEXT NOT NULL, \
|
||||
PRIMARY KEY (Validator,Entry) \
|
||||
);",
|
||||
|
||||
// List of referrals from ripple.txt files.
|
||||
// Validator:
|
||||
@@ -250,19 +250,19 @@ const char* WalletDBInit[] =
|
||||
// Port:
|
||||
// -1 = Default
|
||||
// XXX Do garbage collection when ips have no references.
|
||||
"CREATE TABLE IpReferrals ( \
|
||||
Validator CHARACTER(53) NOT NULL, \
|
||||
Entry INTEGER NOT NULL, \
|
||||
IP TEXT NOT NULL, \
|
||||
Port INTEGER NOT NULL DEFAULT -1, \
|
||||
PRIMARY KEY (Validator,Entry) \
|
||||
);",
|
||||
"CREATE TABLE IpReferrals ( \
|
||||
Validator CHARACTER(53) NOT NULL, \
|
||||
Entry INTEGER NOT NULL, \
|
||||
IP TEXT NOT NULL, \
|
||||
Port INTEGER NOT NULL DEFAULT -1, \
|
||||
PRIMARY KEY (Validator,Entry) \
|
||||
);",
|
||||
|
||||
"CREATE TABLE Features ( \
|
||||
Hash CHARACTER(64) PRIMARY KEY, \
|
||||
FirstMajority BIGINT UNSIGNED, \
|
||||
LastMajority BIGINT UNSIGNED \
|
||||
);",
|
||||
"CREATE TABLE Features ( \
|
||||
Hash CHARACTER(64) PRIMARY KEY, \
|
||||
FirstMajority BIGINT UNSIGNED, \
|
||||
LastMajority BIGINT UNSIGNED \
|
||||
);",
|
||||
|
||||
// This removes an old table and its index which are now redundant. This
|
||||
// code will eventually go away. It's only here to clean up the wallet.db
|
||||
@@ -287,12 +287,12 @@ int HashNodeDBCount = std::extent<decltype(HashNodeDBInit)>::value;
|
||||
/*
|
||||
const char* NetNodeDBInit[] =
|
||||
{
|
||||
"CREATE TABLE KnownNodes ( \
|
||||
Hanko CHARACTER(35) PRIMARY KEY, \
|
||||
LastSeen TEXT, \
|
||||
HaveContactInfo CHARACTER(1), \
|
||||
ContactObject BLOB \
|
||||
);"
|
||||
"CREATE TABLE KnownNodes ( \
|
||||
Hanko CHARACTER(35) PRIMARY KEY, \
|
||||
LastSeen TEXT, \
|
||||
HaveContactInfo CHARACTER(1), \
|
||||
ContactObject BLOB \
|
||||
);"
|
||||
};
|
||||
|
||||
int NetNodeDBCount = std::extent<decltype(NetNodeDBInit)>::value;
|
||||
@@ -307,11 +307,11 @@ const char* PathFindDBInit[] =
|
||||
"DROP TABLE TrustLines; ",
|
||||
|
||||
"CREATE TABLE TrustLines { "
|
||||
"To CHARACTER(40), " // Hex of account trusted
|
||||
"By CHARACTER(40), " // Hex of account trusting
|
||||
"Currency CHARACTER(80), " // Hex currency, hex issuer
|
||||
"Use INTEGER, " // Use count
|
||||
"Seq BIGINT UNSIGNED " // Sequence when use count was updated
|
||||
"To CHARACTER(40), " // Hex of account trusted
|
||||
"By CHARACTER(40), " // Hex of account trusting
|
||||
"Currency CHARACTER(80), " // Hex currency, hex issuer
|
||||
"Use INTEGER, " // Use count
|
||||
"Seq BIGINT UNSIGNED " // Sequence when use count was updated
|
||||
"}; ",
|
||||
|
||||
"CREATE INDEX TLBy ON TrustLines(By, Currency, Use);",
|
||||
@@ -320,8 +320,8 @@ const char* PathFindDBInit[] =
|
||||
"DROP TABLE Exchanges;",
|
||||
|
||||
"CREATE TABLE Exchanges { "
|
||||
"From CHARACTER(80), "
|
||||
"To CHARACTER(80), "
|
||||
"From CHARACTER(80), "
|
||||
"To CHARACTER(80), "
|
||||
"Currency CHARACTER(80), "
|
||||
"Use INTEGER, "
|
||||
"Seq BIGINT UNSIGNED "
|
||||
|
||||
@@ -57,29 +57,29 @@ public:
|
||||
|
||||
if (reason == InboundLedger::fcCONSENSUS)
|
||||
{
|
||||
if (mConsensusLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mConsensusLedger))
|
||||
{
|
||||
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mConsensusLedger);
|
||||
if (it != mLedgers.end ())
|
||||
{
|
||||
oldLedger = it->second;
|
||||
mLedgers.erase (it);
|
||||
}
|
||||
}
|
||||
mConsensusLedger = hash;
|
||||
if (mConsensusLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mConsensusLedger))
|
||||
{
|
||||
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mConsensusLedger);
|
||||
if (it != mLedgers.end ())
|
||||
{
|
||||
oldLedger = it->second;
|
||||
mLedgers.erase (it);
|
||||
}
|
||||
}
|
||||
mConsensusLedger = hash;
|
||||
}
|
||||
else if (reason == InboundLedger::fcVALIDATION)
|
||||
{
|
||||
if (mValidationLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mValidationLedger))
|
||||
{
|
||||
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mValidationLedger);
|
||||
if (it != mLedgers.end ())
|
||||
{
|
||||
oldLedger = it->second;
|
||||
mLedgers.erase (it);
|
||||
}
|
||||
}
|
||||
mValidationLedger = hash;
|
||||
if (mValidationLedger.isNonZero() && (mValidationLedger != mConsensusLedger) && (hash != mValidationLedger))
|
||||
{
|
||||
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (mValidationLedger);
|
||||
if (it != mLedgers.end ())
|
||||
{
|
||||
oldLedger = it->second;
|
||||
mLedgers.erase (it);
|
||||
}
|
||||
}
|
||||
mValidationLedger = hash;
|
||||
}
|
||||
|
||||
hash_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
|
||||
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
closedLedger->setClosed ();
|
||||
closedLedger->setImmutable ();
|
||||
mClosedLedger.set (closedLedger);
|
||||
}
|
||||
}
|
||||
|
||||
mCurrentLedger.set (newLedger);
|
||||
}
|
||||
|
||||
@@ -10,18 +10,18 @@ Amendment must receive at least an 80% approval rate from validating nodes for
|
||||
a period of two weeks before being accepted. The following example outlines the
|
||||
process of an Amendment from its conception to approval and usage.
|
||||
|
||||
* A community member makes proposes to change transaction processing in some
|
||||
* A community member makes proposes to change transaction processing in some
|
||||
way. The proposal is discussed amongst the community and receives its support
|
||||
creating a community or human consensus.
|
||||
|
||||
* Some members contribute their time and work to develop the Amendment.
|
||||
* Some members contribute their time and work to develop the Amendment.
|
||||
|
||||
* A pull request is created and the new code is folded into a rippled build
|
||||
* A pull request is created and the new code is folded into a rippled build
|
||||
and made available for use.
|
||||
|
||||
* The consensus process begins with the validating nodes.
|
||||
* The consensus process begins with the validating nodes.
|
||||
|
||||
* If the Amendment holds an 80% majority for a two week period, nodes will begin
|
||||
* If the Amendment holds an 80% majority for a two week period, nodes will begin
|
||||
including the transaction to enable it in their initial sets.
|
||||
|
||||
Nodes may veto Amendments they consider undesirable by never announcing their
|
||||
|
||||
@@ -33,11 +33,11 @@ static const char* s_nodeStoreDBInit [] =
|
||||
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE CommittedObjects ( \
|
||||
Hash CHARACTER(64) PRIMARY KEY, \
|
||||
ObjType CHAR(1) NOT NULL, \
|
||||
LedgerIndex BIGINT UNSIGNED, \
|
||||
Object BLOB \
|
||||
"CREATE TABLE CommittedObjects ( \
|
||||
Hash CHARACTER(64) PRIMARY KEY, \
|
||||
ObjType CHAR(1) NOT NULL, \
|
||||
LedgerIndex BIGINT UNSIGNED, \
|
||||
Object BLOB \
|
||||
);",
|
||||
|
||||
"END TRANSACTION;"
|
||||
|
||||
@@ -46,21 +46,21 @@ Making a payment in the ripple network is about finding the cheapest path betwee
|
||||
|
||||
There are various stages:
|
||||
|
||||
An issue is a balance in some specific currency. An issuer is someone who “creates” a currency by creating an issue.
|
||||
An issue is a balance in some specific currency. An issuer is someone who "creates" a currency by creating an issue.
|
||||
|
||||
For tx processing, people submit a tx to a rippled node, which attempts to apply the tx locally first, and if succeesful, distributes it to other nodes.
|
||||
|
||||
When someone accepts payment they list their specific payment terms, “what must happen before the payment goes off.” That can be done completely in the Ripple Network. Normally a payment on the Ripple net can be completely settled there. When the ledger closes, the terms are met, or they are not met.
|
||||
When someone accepts payment they list their specific payment terms, "what must happen before the payment goes off." That can be done completely in the Ripple Network. Normally a payment on the Ripple net can be completely settled there. When the ledger closes, the terms are met, or they are not met.
|
||||
|
||||
For a bridge payment, based on a previous promise it will deliver payment off-network. A bridge promises to execute the final leg of a payment, but there’s the possibility of default. If you want to trust a bridge for a specific pathfinding request, you need to include it in the request.
|
||||
For a bridge payment, based on a previous promise it will deliver payment off-network. A bridge promises to execute the final leg of a payment, but there's the possibility of default. If you want to trust a bridge for a specific pathfinding request, you need to include it in the request.
|
||||
|
||||
In contrast, a gateway is in the business of redeeming value on the Ripple Network for value off the Ripnet. A gateway is in the business of issuing balances.
|
||||
|
||||
Bitstamp is a gateway - you send ‘em cash, they give you a ripple balance and vice versa. There’s no promise or forwarding for a transaction.
|
||||
Bitstamp is a gateway - you send 'em cash, they give you a ripple balance and vice versa. There's no promise or forwarding for a transaction.
|
||||
|
||||
A bridge is a facility that allows payments to be made from the Ripnet to off the Ripnet.
|
||||
|
||||
Suppose I’m on the Ripple network and want to send value to the bitcoin network. See: https://ripple.com/wiki/Outbound_Bridge_Payments
|
||||
Suppose I'm on the Ripple network and want to send value to the bitcoin network. See: https://ripple.com/wiki/Outbound_Bridge_Payments
|
||||
https://ripple.com/wiki/Services_API
|
||||
|
||||
|
||||
@@ -70,42 +70,42 @@ Two types of paths:
|
||||
* TODO: find if this is implemented and either document it or file a JIRA.
|
||||
2. I need to deliver X amount of cash to someone - how much will it cost me?
|
||||
|
||||
Here’s a transaction:
|
||||
Here's a transaction:
|
||||
https://ripple.com/wiki/Transaction_Format#Payment_.280.29
|
||||
|
||||
Not implemented: bridge types.
|
||||
|
||||
|
||||
|
||||
|
||||
High level of a payment
|
||||
-----------------------
|
||||
|
||||
1. I make a request for path finding to a rippled.
|
||||
2. That rippled “continuously” returns solutions until I “stop”.
|
||||
2. That rippled "continuously" returns solutions until I "stop".
|
||||
3. You create a transaction which includes the path set that you got from the quote.
|
||||
4. You sign it.
|
||||
5. You submit it to one or more rippleds.
|
||||
6. Those rippled validates it, and forwards it if it’s valid.
|
||||
* valid means “not malformed” and “can claim a fee” - the sending account has enough to cover the transaction fee.
|
||||
6. Those rippled validates it, and forwards it if it;s valid.
|
||||
* valid means "not malformed" and "can claim a fee" - the sending account has enough to cover the transaction fee.
|
||||
7. At ledger closing time, the transaction is applied by the transaction engine and the result is stored by changing the ledger and storing the tx metadata in that ledger.
|
||||
|
||||
If you’re sending and receiving XRP you don’t need a path.
|
||||
If the union of the default paths are sufficient, you don’t need a path set (see below about default paths).
|
||||
If you're sending and receiving XRP you don't need a path.
|
||||
If the union of the default paths are sufficient, you don't need a path set (see below about default paths).
|
||||
The idea behind path sets is to provide sufficient liquidity in the face of a changing ledger.
|
||||
|
||||
If you can compute a path already yourself or know one, you don’t need to do steps 1 or 2.
|
||||
If you can compute a path already yourself or know one, you don't need to do steps 1 or 2.
|
||||
|
||||
|
||||
1. Finding liquidity - “path finding”
|
||||
* finding paths (exactly “path finding”)
|
||||
1. Finding liquidity - "path finding"
|
||||
* finding paths (exactly "path finding")
|
||||
* filtering by liquidity.
|
||||
* take a selection of paths that should satisfy the transaction’s conditions.
|
||||
* take a selection of paths that should satisfy the transaction's conditions.
|
||||
* This routine is called RippleCalc::rippleCalc.
|
||||
|
||||
2. Build a payment transaction containing the path set.
|
||||
* a path set is a group of paths that a transaction is supposed to use for liquidity
|
||||
* default paths are not included
|
||||
* zero hop path: a default path is “source directly to destination”.
|
||||
* zero hop path: a default path is "source directly to destination".
|
||||
* one hop paths - because they can be derived from the source and destination currency.
|
||||
* A payment transaction includes the following fields
|
||||
* the source account
|
||||
@@ -120,20 +120,20 @@ If you can compute a path already yourself or know one, you don’t need to do s
|
||||
* if not specified, defaults to the destination amount with the sender as issuer.
|
||||
* contains an amount and a currency
|
||||
* if currency not XRP, must have a specified issuer.
|
||||
* specifying the sender as issuer allows any of the sender’s issuance to be spent.
|
||||
* specifying the sender as issuer allows any of the sender's issuance to be spent.
|
||||
* specifying a specific issuer allows only that specific issuance to be sent.
|
||||
* path set.
|
||||
* Optional.
|
||||
* Might contain “invalid” paths or even “gibberish” for an untrusted server.
|
||||
* Might contain "invalid" paths or even "gibberish" for an untrusted server.
|
||||
* An untrusted server could provide proof that their paths are actually valid.
|
||||
* That would NOT prove that this is the cheapest path.
|
||||
* The client needs to talk to multiple untrusted servers, get proofs and then pick the best path.
|
||||
* It’s much easier to validate a proof of a path than to find one, because you need a lot of information to find one.
|
||||
* It's much easier to validate a proof of a path than to find one, because you need a lot of information to find one.
|
||||
* In the future we might allow one server to validate a path offered by another server.
|
||||
|
||||
3. Executing a payment
|
||||
* very little time, can’t afford to do a search.
|
||||
* that’s why we do the path building before the payment is due.
|
||||
* very little time, can't afford to do a search.
|
||||
* that's why we do the path building before the payment is due.
|
||||
* The routine used to compute liquidity and ledger change is also called RippleCalc::rippleCalc.
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ void PeerSet::TimerEntry (std::weak_ptr<PeerSet> wptr, const boost::system::erro
|
||||
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "timerEntryLgr",
|
||||
std::bind (&PeerSet::TimerJobEntry, std::placeholders::_1,
|
||||
ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,15 +113,15 @@ public:
|
||||
{
|
||||
if (!ret.empty())
|
||||
ret.append(" ");
|
||||
ret.append("bad:");
|
||||
ret.append(beast::lexicalCastThrow<std::string>(mBad));
|
||||
ret.append("bad:");
|
||||
ret.append(beast::lexicalCastThrow<std::string>(mBad));
|
||||
}
|
||||
if (mDuplicate > 0)
|
||||
{
|
||||
if (!ret.empty())
|
||||
ret.append(" ");
|
||||
ret.append("dupe:");
|
||||
ret.append(beast::lexicalCastThrow<std::string>(mDuplicate));
|
||||
ret.append("dupe:");
|
||||
ret.append(beast::lexicalCastThrow<std::string>(mDuplicate));
|
||||
}
|
||||
if (ret.empty ())
|
||||
ret = "no nodes processed";
|
||||
|
||||
@@ -358,7 +358,7 @@ CreateOffer::doApply ()
|
||||
to_string (mTxnAccountID);
|
||||
m_journal.debug <<
|
||||
"takeOffers: FUNDS=" << view.accountFunds (
|
||||
mTxnAccountID, saTakerGets, fhZERO_IF_FROZEN).getFullText ();
|
||||
mTxnAccountID, saTakerGets, fhZERO_IF_FROZEN).getFullText ();
|
||||
}
|
||||
|
||||
if (saTakerPays < zero || saTakerGets < zero)
|
||||
|
||||
@@ -164,15 +164,15 @@ public:
|
||||
mSocket->async_shutdown (handler);
|
||||
else
|
||||
{
|
||||
error_code ec;
|
||||
try
|
||||
{
|
||||
lowest_layer ().shutdown (plain_socket::shutdown_both);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
ec = e.code();
|
||||
}
|
||||
error_code ec;
|
||||
try
|
||||
{
|
||||
lowest_layer ().shutdown (plain_socket::shutdown_both);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
ec = e.code();
|
||||
}
|
||||
mSocket->get_io_service ().post (
|
||||
beast::asio::bind_handler (handler, ec));
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ contains. The fields are as follows:
|
||||
An enumeration that determines what the blob holds. There are four
|
||||
different types of objects stored.
|
||||
|
||||
* **ledger**
|
||||
|
||||
* **ledger**
|
||||
|
||||
A ledger header.
|
||||
|
||||
* **transaction**
|
||||
|
||||
@@ -75,40 +75,40 @@ void
|
||||
PeerImp::getLedger (protocol::TMGetLedger& packet)
|
||||
{
|
||||
SHAMap::pointer map;
|
||||
protocol::TMLedgerData reply;
|
||||
bool fatLeaves = true, fatRoot = false;
|
||||
protocol::TMLedgerData reply;
|
||||
bool fatLeaves = true, fatRoot = false;
|
||||
|
||||
if (packet.has_requestcookie ())
|
||||
reply.set_requestcookie (packet.requestcookie ());
|
||||
if (packet.has_requestcookie ())
|
||||
reply.set_requestcookie (packet.requestcookie ());
|
||||
|
||||
std::string logMe;
|
||||
std::string logMe;
|
||||
|
||||
if (packet.itype () == protocol::liTS_CANDIDATE)
|
||||
{
|
||||
// Request is for a transaction candidate set
|
||||
m_journal.trace << "Received request for TX candidate set data "
|
||||
<< to_string (this);
|
||||
if (packet.itype () == protocol::liTS_CANDIDATE)
|
||||
{
|
||||
// Request is for a transaction candidate set
|
||||
m_journal.trace << "Received request for TX candidate set data "
|
||||
<< to_string (this);
|
||||
|
||||
if ((!packet.has_ledgerhash () || packet.ledgerhash ().size () != 32))
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "invalid request for TX candidate set data";
|
||||
return;
|
||||
}
|
||||
if ((!packet.has_ledgerhash () || packet.ledgerhash ().size () != 32))
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "invalid request for TX candidate set data";
|
||||
return;
|
||||
}
|
||||
|
||||
uint256 txHash;
|
||||
memcpy (txHash.begin (), packet.ledgerhash ().data (), 32);
|
||||
uint256 txHash;
|
||||
memcpy (txHash.begin (), packet.ledgerhash ().data (), 32);
|
||||
|
||||
{
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock ());
|
||||
map = getApp().getOPs ().getTXMap (txHash);
|
||||
}
|
||||
{
|
||||
Application::ScopedLockType lock (getApp ().getMasterLock ());
|
||||
map = getApp().getOPs ().getTXMap (txHash);
|
||||
}
|
||||
|
||||
if (!map)
|
||||
{
|
||||
if (packet.has_querytype () && !packet.has_requestcookie ())
|
||||
{
|
||||
m_journal.debug << "Trying to route TX set request";
|
||||
if (!map)
|
||||
{
|
||||
if (packet.has_querytype () && !packet.has_requestcookie ())
|
||||
{
|
||||
m_journal.debug << "Trying to route TX set request";
|
||||
|
||||
struct get_usable_peers
|
||||
{
|
||||
@@ -134,7 +134,7 @@ PeerImp::getLedger (protocol::TMGetLedger& packet)
|
||||
}
|
||||
};
|
||||
|
||||
Overlay::PeerSequence usablePeers (m_overlay.foreach (
|
||||
Overlay::PeerSequence usablePeers (m_overlay.foreach (
|
||||
get_usable_peers (txHash, this)));
|
||||
|
||||
if (usablePeers.empty ())
|
||||
@@ -148,61 +148,61 @@ PeerImp::getLedger (protocol::TMGetLedger& packet)
|
||||
selectedPeer->send (
|
||||
std::make_shared<Message> (packet, protocol::mtGET_LEDGER));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_journal.error << "We do not have the map our peer wants "
|
||||
<< to_string (this);
|
||||
m_journal.error << "We do not have the map our peer wants "
|
||||
<< to_string (this);
|
||||
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
reply.set_ledgerseq (0);
|
||||
reply.set_ledgerhash (txHash.begin (), txHash.size ());
|
||||
reply.set_type (protocol::liTS_CANDIDATE);
|
||||
fatLeaves = false; // We'll already have most transactions
|
||||
fatRoot = true; // Save a pass
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getApp().getFeeTrack().isLoadedLocal() && !m_clusterNode)
|
||||
{
|
||||
m_journal.debug << "Too busy to fetch ledger data";
|
||||
return;
|
||||
}
|
||||
reply.set_ledgerhash (txHash.begin (), txHash.size ());
|
||||
reply.set_type (protocol::liTS_CANDIDATE);
|
||||
fatLeaves = false; // We'll already have most transactions
|
||||
fatRoot = true; // Save a pass
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getApp().getFeeTrack().isLoadedLocal() && !m_clusterNode)
|
||||
{
|
||||
m_journal.debug << "Too busy to fetch ledger data";
|
||||
return;
|
||||
}
|
||||
|
||||
// Figure out what ledger they want
|
||||
m_journal.trace << "Received request for ledger data "
|
||||
<< to_string (this);
|
||||
Ledger::pointer ledger;
|
||||
// Figure out what ledger they want
|
||||
m_journal.trace << "Received request for ledger data "
|
||||
<< to_string (this);
|
||||
Ledger::pointer ledger;
|
||||
|
||||
if (packet.has_ledgerhash ())
|
||||
{
|
||||
uint256 ledgerhash;
|
||||
if (packet.has_ledgerhash ())
|
||||
{
|
||||
uint256 ledgerhash;
|
||||
|
||||
if (packet.ledgerhash ().size () != 32)
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "Invalid request";
|
||||
return;
|
||||
}
|
||||
if (packet.ledgerhash ().size () != 32)
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "Invalid request";
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy (ledgerhash.begin (), packet.ledgerhash ().data (), 32);
|
||||
logMe += "LedgerHash:";
|
||||
logMe += to_string (ledgerhash);
|
||||
ledger = getApp().getLedgerMaster ().getLedgerByHash (ledgerhash);
|
||||
memcpy (ledgerhash.begin (), packet.ledgerhash ().data (), 32);
|
||||
logMe += "LedgerHash:";
|
||||
logMe += to_string (ledgerhash);
|
||||
ledger = getApp().getLedgerMaster ().getLedgerByHash (ledgerhash);
|
||||
|
||||
if (!ledger && m_journal.trace)
|
||||
m_journal.trace << "Don't have ledger " << ledgerhash;
|
||||
if (!ledger && m_journal.trace)
|
||||
m_journal.trace << "Don't have ledger " << ledgerhash;
|
||||
|
||||
if (!ledger && (packet.has_querytype () && !packet.has_requestcookie ()))
|
||||
{
|
||||
std::uint32_t seq = 0;
|
||||
if (!ledger && (packet.has_querytype () && !packet.has_requestcookie ()))
|
||||
{
|
||||
std::uint32_t seq = 0;
|
||||
|
||||
if (packet.has_ledgerseq ())
|
||||
seq = packet.ledgerseq ();
|
||||
if (packet.has_ledgerseq ())
|
||||
seq = packet.ledgerseq ();
|
||||
|
||||
Overlay::PeerSequence peerList = m_overlay.getActivePeers ();
|
||||
Overlay::PeerSequence peerList = m_overlay.getActivePeers ();
|
||||
Overlay::PeerSequence usablePeers;
|
||||
BOOST_FOREACH (Peer::ptr const& peer, peerList)
|
||||
{
|
||||
@@ -223,45 +223,45 @@ PeerImp::getLedger (protocol::TMGetLedger& packet)
|
||||
m_journal.debug << "Ledger request routed";
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (packet.has_ledgerseq ())
|
||||
{
|
||||
if (packet.ledgerseq() < getApp().getLedgerMaster().getEarliestFetch())
|
||||
{
|
||||
m_journal.debug << "Peer requests early ledger";
|
||||
return;
|
||||
}
|
||||
ledger = getApp().getLedgerMaster ().getLedgerBySeq (packet.ledgerseq ());
|
||||
if (!ledger && m_journal.debug)
|
||||
m_journal.debug << "Don't have ledger " << packet.ledgerseq ();
|
||||
}
|
||||
else if (packet.has_ltype () && (packet.ltype () == protocol::ltCURRENT))
|
||||
{
|
||||
ledger = getApp().getLedgerMaster ().getCurrentLedger ();
|
||||
}
|
||||
else if (packet.has_ltype () && (packet.ltype () == protocol::ltCLOSED) )
|
||||
{
|
||||
ledger = getApp().getLedgerMaster ().getClosedLedger ();
|
||||
}
|
||||
else if (packet.has_ledgerseq ())
|
||||
{
|
||||
if (packet.ledgerseq() < getApp().getLedgerMaster().getEarliestFetch())
|
||||
{
|
||||
m_journal.debug << "Peer requests early ledger";
|
||||
return;
|
||||
}
|
||||
ledger = getApp().getLedgerMaster ().getLedgerBySeq (packet.ledgerseq ());
|
||||
if (!ledger && m_journal.debug)
|
||||
m_journal.debug << "Don't have ledger " << packet.ledgerseq ();
|
||||
}
|
||||
else if (packet.has_ltype () && (packet.ltype () == protocol::ltCURRENT))
|
||||
{
|
||||
ledger = getApp().getLedgerMaster ().getCurrentLedger ();
|
||||
}
|
||||
else if (packet.has_ltype () && (packet.ltype () == protocol::ltCLOSED) )
|
||||
{
|
||||
ledger = getApp().getLedgerMaster ().getClosedLedger ();
|
||||
|
||||
if (ledger && !ledger->isClosed ())
|
||||
ledger = getApp().getLedgerMaster ().getLedgerBySeq (ledger->getLedgerSeq () - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "Can't figure out what ledger they want";
|
||||
return;
|
||||
}
|
||||
if (ledger && !ledger->isClosed ())
|
||||
ledger = getApp().getLedgerMaster ().getLedgerBySeq (ledger->getLedgerSeq () - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
m_journal.warning << "Can't figure out what ledger they want";
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!ledger) || (packet.has_ledgerseq () && (packet.ledgerseq () != ledger->getLedgerSeq ())))
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
if ((!ledger) || (packet.has_ledgerseq () && (packet.ledgerseq () != ledger->getLedgerSeq ())))
|
||||
{
|
||||
charge (Resource::feeInvalidRequest);
|
||||
|
||||
if (m_journal.warning && ledger)
|
||||
m_journal.warning << "Ledger has wrong sequence";
|
||||
if (m_journal.warning && ledger)
|
||||
m_journal.warning << "Ledger has wrong sequence";
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!packet.has_ledgerseq() && (ledger->getLedgerSeq() < getApp().getLedgerMaster().getEarliestFetch()))
|
||||
{
|
||||
@@ -269,132 +269,132 @@ PeerImp::getLedger (protocol::TMGetLedger& packet)
|
||||
return;
|
||||
}
|
||||
|
||||
// Fill out the reply
|
||||
uint256 lHash = ledger->getHash ();
|
||||
reply.set_ledgerhash (lHash.begin (), lHash.size ());
|
||||
reply.set_ledgerseq (ledger->getLedgerSeq ());
|
||||
reply.set_type (packet.itype ());
|
||||
// Fill out the reply
|
||||
uint256 lHash = ledger->getHash ();
|
||||
reply.set_ledgerhash (lHash.begin (), lHash.size ());
|
||||
reply.set_ledgerseq (ledger->getLedgerSeq ());
|
||||
reply.set_type (packet.itype ());
|
||||
|
||||
if (packet.itype () == protocol::liBASE)
|
||||
{
|
||||
// they want the ledger base data
|
||||
m_journal.trace << "They want ledger base data";
|
||||
Serializer nData (128);
|
||||
ledger->addRaw (nData);
|
||||
reply.add_nodes ()->set_nodedata (nData.getDataPtr (), nData.getLength ());
|
||||
if (packet.itype () == protocol::liBASE)
|
||||
{
|
||||
// they want the ledger base data
|
||||
m_journal.trace << "They want ledger base data";
|
||||
Serializer nData (128);
|
||||
ledger->addRaw (nData);
|
||||
reply.add_nodes ()->set_nodedata (nData.getDataPtr (), nData.getLength ());
|
||||
|
||||
SHAMap::pointer map = ledger->peekAccountStateMap ();
|
||||
SHAMap::pointer map = ledger->peekAccountStateMap ();
|
||||
|
||||
if (map && map->getHash ().isNonZero ())
|
||||
{
|
||||
// return account state root node if possible
|
||||
Serializer rootNode (768);
|
||||
if (map && map->getHash ().isNonZero ())
|
||||
{
|
||||
// return account state root node if possible
|
||||
Serializer rootNode (768);
|
||||
|
||||
if (map->getRootNode (rootNode, snfWIRE))
|
||||
{
|
||||
reply.add_nodes ()->set_nodedata (rootNode.getDataPtr (), rootNode.getLength ());
|
||||
if (map->getRootNode (rootNode, snfWIRE))
|
||||
{
|
||||
reply.add_nodes ()->set_nodedata (rootNode.getDataPtr (), rootNode.getLength ());
|
||||
|
||||
if (ledger->getTransHash ().isNonZero ())
|
||||
{
|
||||
map = ledger->peekTransactionMap ();
|
||||
if (ledger->getTransHash ().isNonZero ())
|
||||
{
|
||||
map = ledger->peekTransactionMap ();
|
||||
|
||||
if (map && map->getHash ().isNonZero ())
|
||||
{
|
||||
rootNode.erase ();
|
||||
if (map && map->getHash ().isNonZero ())
|
||||
{
|
||||
rootNode.erase ();
|
||||
|
||||
if (map->getRootNode (rootNode, snfWIRE))
|
||||
reply.add_nodes ()->set_nodedata (rootNode.getDataPtr (), rootNode.getLength ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (map->getRootNode (rootNode, snfWIRE))
|
||||
reply.add_nodes ()->set_nodedata (rootNode.getDataPtr (), rootNode.getLength ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Message::pointer oPacket = std::make_shared<Message> (reply, protocol::mtLEDGER_DATA);
|
||||
send (oPacket);
|
||||
return;
|
||||
}
|
||||
Message::pointer oPacket = std::make_shared<Message> (reply, protocol::mtLEDGER_DATA);
|
||||
send (oPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.itype () == protocol::liTX_NODE)
|
||||
{
|
||||
map = ledger->peekTransactionMap ();
|
||||
logMe += " TX:";
|
||||
logMe += to_string (map->getHash ());
|
||||
}
|
||||
else if (packet.itype () == protocol::liAS_NODE)
|
||||
{
|
||||
map = ledger->peekAccountStateMap ();
|
||||
logMe += " AS:";
|
||||
logMe += to_string (map->getHash ());
|
||||
}
|
||||
}
|
||||
if (packet.itype () == protocol::liTX_NODE)
|
||||
{
|
||||
map = ledger->peekTransactionMap ();
|
||||
logMe += " TX:";
|
||||
logMe += to_string (map->getHash ());
|
||||
}
|
||||
else if (packet.itype () == protocol::liAS_NODE)
|
||||
{
|
||||
map = ledger->peekAccountStateMap ();
|
||||
logMe += " AS:";
|
||||
logMe += to_string (map->getHash ());
|
||||
}
|
||||
}
|
||||
|
||||
if (!map || (packet.nodeids_size () == 0))
|
||||
{
|
||||
m_journal.warning << "Can't find map or empty request";
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
if (!map || (packet.nodeids_size () == 0))
|
||||
{
|
||||
m_journal.warning << "Can't find map or empty request";
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
m_journal.trace << "Request: " << logMe;
|
||||
m_journal.trace << "Request: " << logMe;
|
||||
|
||||
for (int i = 0; i < packet.nodeids ().size (); ++i)
|
||||
{
|
||||
SHAMapNodeID mn (packet.nodeids (i).data (), packet.nodeids (i).size ());
|
||||
for (int i = 0; i < packet.nodeids ().size (); ++i)
|
||||
{
|
||||
SHAMapNodeID mn (packet.nodeids (i).data (), packet.nodeids (i).size ());
|
||||
|
||||
if (!mn.isValid ())
|
||||
{
|
||||
m_journal.warning << "Request for invalid node: " << logMe;
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
if (!mn.isValid ())
|
||||
{
|
||||
m_journal.warning << "Request for invalid node: " << logMe;
|
||||
charge (Resource::feeInvalidRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<SHAMapNodeID> nodeIDs;
|
||||
std::list< Blob > rawNodes;
|
||||
std::vector<SHAMapNodeID> nodeIDs;
|
||||
std::list< Blob > rawNodes;
|
||||
|
||||
try
|
||||
{
|
||||
if (map->getNodeFat (mn, nodeIDs, rawNodes, fatRoot, fatLeaves))
|
||||
{
|
||||
assert (nodeIDs.size () == rawNodes.size ());
|
||||
m_journal.trace << "getNodeFat got " << rawNodes.size () << " nodes";
|
||||
std::vector<SHAMapNodeID>::iterator nodeIDIterator;
|
||||
std::list< Blob >::iterator rawNodeIterator;
|
||||
try
|
||||
{
|
||||
if (map->getNodeFat (mn, nodeIDs, rawNodes, fatRoot, fatLeaves))
|
||||
{
|
||||
assert (nodeIDs.size () == rawNodes.size ());
|
||||
m_journal.trace << "getNodeFat got " << rawNodes.size () << " nodes";
|
||||
std::vector<SHAMapNodeID>::iterator nodeIDIterator;
|
||||
std::list< Blob >::iterator rawNodeIterator;
|
||||
|
||||
for (nodeIDIterator = nodeIDs.begin (), rawNodeIterator = rawNodes.begin ();
|
||||
nodeIDIterator != nodeIDs.end (); ++nodeIDIterator, ++rawNodeIterator)
|
||||
{
|
||||
Serializer nID (33);
|
||||
nodeIDIterator->addIDRaw (nID);
|
||||
protocol::TMLedgerNode* node = reply.add_nodes ();
|
||||
node->set_nodeid (nID.getDataPtr (), nID.getLength ());
|
||||
node->set_nodedata (&rawNodeIterator->front (), rawNodeIterator->size ());
|
||||
}
|
||||
}
|
||||
else
|
||||
m_journal.warning << "getNodeFat returns false";
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
std::string info;
|
||||
for (nodeIDIterator = nodeIDs.begin (), rawNodeIterator = rawNodes.begin ();
|
||||
nodeIDIterator != nodeIDs.end (); ++nodeIDIterator, ++rawNodeIterator)
|
||||
{
|
||||
Serializer nID (33);
|
||||
nodeIDIterator->addIDRaw (nID);
|
||||
protocol::TMLedgerNode* node = reply.add_nodes ();
|
||||
node->set_nodeid (nID.getDataPtr (), nID.getLength ());
|
||||
node->set_nodedata (&rawNodeIterator->front (), rawNodeIterator->size ());
|
||||
}
|
||||
}
|
||||
else
|
||||
m_journal.warning << "getNodeFat returns false";
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
std::string info;
|
||||
|
||||
if (packet.itype () == protocol::liTS_CANDIDATE)
|
||||
info = "TS candidate";
|
||||
else if (packet.itype () == protocol::liBASE)
|
||||
info = "Ledger base";
|
||||
else if (packet.itype () == protocol::liTX_NODE)
|
||||
info = "TX node";
|
||||
else if (packet.itype () == protocol::liAS_NODE)
|
||||
info = "AS node";
|
||||
if (packet.itype () == protocol::liTS_CANDIDATE)
|
||||
info = "TS candidate";
|
||||
else if (packet.itype () == protocol::liBASE)
|
||||
info = "Ledger base";
|
||||
else if (packet.itype () == protocol::liTX_NODE)
|
||||
info = "TX node";
|
||||
else if (packet.itype () == protocol::liAS_NODE)
|
||||
info = "AS node";
|
||||
|
||||
if (!packet.has_ledgerhash ())
|
||||
info += ", no hash specified";
|
||||
if (!packet.has_ledgerhash ())
|
||||
info += ", no hash specified";
|
||||
|
||||
m_journal.warning << "getNodeFat( " << mn << ") throws exception: " << info;
|
||||
}
|
||||
}
|
||||
m_journal.warning << "getNodeFat( " << mn << ") throws exception: " << info;
|
||||
}
|
||||
}
|
||||
|
||||
Message::pointer oPacket = std::make_shared<Message> (reply, protocol::mtLEDGER_DATA);
|
||||
send (oPacket);
|
||||
Message::pointer oPacket = std::make_shared<Message> (reply, protocol::mtLEDGER_DATA);
|
||||
send (oPacket);
|
||||
}
|
||||
|
||||
// This is dispatched by the job queue
|
||||
|
||||
@@ -1010,7 +1010,7 @@ private:
|
||||
std::lock_guard<std::mutex> sl(m_recentLock);
|
||||
|
||||
if(std::find (m_recentTxSets.begin (), m_recentTxSets.end (), hash) != m_recentTxSets.end ())
|
||||
return;
|
||||
return;
|
||||
|
||||
if (m_recentTxSets.size () == 128)
|
||||
m_recentTxSets.pop_front ();
|
||||
@@ -1177,7 +1177,7 @@ private:
|
||||
pPeers->foreach (send_if_not (
|
||||
std::make_shared<Message> (set, protocol::mtPROPOSE_LEDGER),
|
||||
peer_in_set(peers)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user