mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Compare commits
4 Commits
copilot/re
...
mvadari/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7de9560048 | ||
|
|
568623f699 | ||
|
|
cf33298abd | ||
|
|
b46ca16f7d |
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace xrpl {
|
||||
@throws runtime_error
|
||||
*/
|
||||
void
|
||||
extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst);
|
||||
extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
std::string
|
||||
getFileContents(
|
||||
std::error_code& ec,
|
||||
std::filesystem::path const& sourcePath,
|
||||
boost::system::error_code& ec,
|
||||
boost::filesystem::path const& sourcePath,
|
||||
std::optional<std::size_t> maxSize = std::nullopt);
|
||||
|
||||
void
|
||||
writeFileContents(
|
||||
std::error_code& ec,
|
||||
std::filesystem::path const& destPath,
|
||||
boost::system::error_code& ec,
|
||||
boost::filesystem::path const& destPath,
|
||||
std::string const& contents);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
@return `true` if the file was opened.
|
||||
*/
|
||||
bool
|
||||
open(std::filesystem::path const& path);
|
||||
open(boost::filesystem::path const& path);
|
||||
|
||||
/** Close and re-open the system file associated with the log
|
||||
This assists in interoperating with external log management tools.
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
|
||||
private:
|
||||
std::unique_ptr<std::ofstream> m_stream;
|
||||
std::filesystem::path m_path;
|
||||
boost::filesystem::path m_path;
|
||||
};
|
||||
|
||||
std::mutex mutable mutex_;
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
virtual ~Logs() = default;
|
||||
|
||||
bool
|
||||
open(std::filesystem::path const& pathToLogFile);
|
||||
open(boost::filesystem::path const& pathToLogFile);
|
||||
|
||||
beast::Journal::Sink&
|
||||
get(std::string const& name);
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <xrpl/beast/unit_test/runner.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -25,7 +25,7 @@ make_reason(String const& reason, char const* file, int line)
|
||||
std::string s(reason);
|
||||
if (!s.empty())
|
||||
s.append(": ");
|
||||
namespace fs = std::filesystem;
|
||||
namespace fs = boost::filesystem;
|
||||
s.append(fs::path{file}.filename().string());
|
||||
s.append("(");
|
||||
s.append(boost::lexical_cast<std::string>(line));
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -16,7 +13,7 @@ namespace beast {
|
||||
*/
|
||||
class temp_dir
|
||||
{
|
||||
std::filesystem::path path_;
|
||||
boost::filesystem::path path_;
|
||||
|
||||
public:
|
||||
#if !GENERATING_DOCS
|
||||
@@ -28,30 +25,20 @@ public:
|
||||
/// Construct a temporary directory.
|
||||
temp_dir()
|
||||
{
|
||||
auto const dir = std::filesystem::temp_directory_path();
|
||||
std::random_device rd;
|
||||
constexpr std::size_t maxAttempts = 100;
|
||||
for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt)
|
||||
auto const dir = boost::filesystem::temp_directory_path();
|
||||
do
|
||||
{
|
||||
std::error_code ec;
|
||||
std::ostringstream oss;
|
||||
oss << std::hex << std::setfill('0') << std::setw(8) << rd() << std::setw(8) << rd();
|
||||
path_ = dir / oss.str();
|
||||
if (!std::filesystem::exists(path_, ec) && !ec)
|
||||
break;
|
||||
path_.clear();
|
||||
}
|
||||
if (path_.empty())
|
||||
throw std::runtime_error("Unable to generate a unique temporary directory path");
|
||||
std::filesystem::create_directory(path_);
|
||||
path_ = dir / boost::filesystem::unique_path();
|
||||
} while (boost::filesystem::exists(path_));
|
||||
boost::filesystem::create_directory(path_);
|
||||
}
|
||||
|
||||
/// Destroy a temporary directory.
|
||||
~temp_dir()
|
||||
{
|
||||
// use non-throwing calls in the destructor
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(path_, ec);
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::remove_all(path_, ec);
|
||||
// TODO: warn/notify if ec set ?
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
#include <xrpl/core/JobTypes.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -42,7 +43,7 @@ public:
|
||||
*/
|
||||
struct Setup
|
||||
{
|
||||
std::filesystem::path perfLog;
|
||||
boost::filesystem::path perfLog;
|
||||
// log_interval is in milliseconds to support faster testing.
|
||||
milliseconds logInterval{seconds(1)};
|
||||
};
|
||||
@@ -147,7 +148,7 @@ public:
|
||||
};
|
||||
|
||||
PerfLog::Setup
|
||||
setup_PerfLog(Section const& section, std::filesystem::path const& configDir);
|
||||
setup_PerfLog(Section const& section, boost::filesystem::path const& configDir);
|
||||
|
||||
std::unique_ptr<PerfLog>
|
||||
make_PerfLog(
|
||||
|
||||
@@ -23,6 +23,12 @@ enum SOEStyle {
|
||||
/** Amount fields that can support MPT */
|
||||
enum SOETxMPTIssue { soeMPTNone, soeMPTSupported, soeMPTNotSupported };
|
||||
|
||||
enum SOEConstant {
|
||||
soeCONSTANTINVALID = 0,
|
||||
soeCONSTANT = 1,
|
||||
soeNOTCONSTANT = 2,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** An element in a SOTemplate. */
|
||||
@@ -31,6 +37,7 @@ class SOElement
|
||||
// Use std::reference_wrapper so SOElement can be stored in a std::vector.
|
||||
std::reference_wrapper<SField const> sField_;
|
||||
SOEStyle style_;
|
||||
SOEConstant constant_ = soeCONSTANTINVALID;
|
||||
SOETxMPTIssue supportMpt_ = soeMPTNone;
|
||||
|
||||
private:
|
||||
@@ -52,6 +59,12 @@ public:
|
||||
init(fieldName);
|
||||
}
|
||||
|
||||
SOElement(SField const& fieldName, SOEStyle style, SOEConstant constant)
|
||||
: sField_(fieldName), style_(style), constant_(constant)
|
||||
{
|
||||
init(fieldName);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires(std::is_same_v<T, STAmount> || std::is_same_v<T, STIssue>)
|
||||
SOElement(
|
||||
@@ -63,6 +76,18 @@ public:
|
||||
init(fieldName);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires(std::is_same_v<T, STAmount> || std::is_same_v<T, STIssue>)
|
||||
SOElement(
|
||||
TypedField<T> const& fieldName,
|
||||
SOEStyle style,
|
||||
SOEConstant constant,
|
||||
SOETxMPTIssue supportMpt = soeMPTNotSupported)
|
||||
: sField_(fieldName), style_(style), constant_(constant), supportMpt_(supportMpt)
|
||||
{
|
||||
init(fieldName);
|
||||
}
|
||||
|
||||
[[nodiscard]] SField const&
|
||||
sField() const
|
||||
{
|
||||
@@ -75,6 +100,12 @@ public:
|
||||
return style_;
|
||||
}
|
||||
|
||||
[[nodiscard]] SOEConstant
|
||||
constant() const
|
||||
{
|
||||
return constant_;
|
||||
}
|
||||
|
||||
[[nodiscard]] SOETxMPTIssue
|
||||
supportMPT() const
|
||||
{
|
||||
|
||||
@@ -36,7 +36,6 @@ XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultN
|
||||
XRPL_FEATURE(Batch, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
|
||||
// Check flags in Credential transactions
|
||||
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
\sa keylet::nftoffer
|
||||
*/
|
||||
LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfNFTokenID, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfNFTokenOfferNode, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED, soeCONSTANT},
|
||||
{sfNFTokenID, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfNFTokenOfferNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeOPTIONAL, soeCONSTANT},
|
||||
{sfExpiration, soeOPTIONAL, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a check.
|
||||
@@ -40,18 +40,18 @@ LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
||||
\sa keylet::check
|
||||
*/
|
||||
LEDGER_ENTRY(ltCHECK, 0x0043, Check, check, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSendMax, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfDestinationNode, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfInvoiceID, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeREQUIRED, soeCONSTANT},
|
||||
{sfSendMax, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestinationNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfExpiration, soeOPTIONAL, soeCONSTANT},
|
||||
{sfInvoiceID, soeOPTIONAL, soeCONSTANT},
|
||||
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the DID.
|
||||
@@ -59,13 +59,13 @@ LEDGER_ENTRY(ltCHECK, 0x0043, Check, check, ({
|
||||
\sa keylet::did
|
||||
*/
|
||||
LEDGER_ENTRY(ltDID, 0x0049, DID, did, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDIDDocument, soeOPTIONAL},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfData, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfDIDDocument, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfData, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the current negative UNL state.
|
||||
@@ -75,11 +75,11 @@ LEDGER_ENTRY(ltDID, 0x0049, DID, did, ({
|
||||
\sa keylet::negativeUNL
|
||||
*/
|
||||
LEDGER_ENTRY(ltNEGATIVE_UNL, 0x004e, NegativeUNL, nunl, ({
|
||||
{sfDisabledValidators, soeOPTIONAL},
|
||||
{sfValidatorToDisable, soeOPTIONAL},
|
||||
{sfValidatorToReEnable, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfDisabledValidators, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfValidatorToDisable, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfValidatorToReEnable, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a list of NFTs
|
||||
@@ -87,11 +87,11 @@ LEDGER_ENTRY(ltNEGATIVE_UNL, 0x004e, NegativeUNL, nunl, ({
|
||||
\sa keylet::nftpage_min, keylet::nftpage_max, keylet::nftpage
|
||||
*/
|
||||
LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
|
||||
{sfPreviousPageMin, soeOPTIONAL},
|
||||
{sfNextPageMin, soeOPTIONAL},
|
||||
{sfNFTokens, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfPreviousPageMin, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfNextPageMin, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfNFTokens, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a signer list for an account.
|
||||
@@ -101,13 +101,13 @@ LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
|
||||
// All fields are soeREQUIRED because there is always a SignerEntries.
|
||||
// If there are no SignerEntries the node is deleted.
|
||||
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
||||
{sfOwner, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfSignerQuorum, soeREQUIRED},
|
||||
{sfSignerEntries, soeREQUIRED},
|
||||
{sfSignerListID, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, soeOPTIONAL, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignerQuorum, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfSignerEntries, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfSignerListID, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a ticket.
|
||||
@@ -115,11 +115,11 @@ LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
||||
\sa keylet::ticket
|
||||
*/
|
||||
LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfTicketSequence, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfTicketSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes an account.
|
||||
@@ -127,29 +127,29 @@ LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
|
||||
\sa keylet::account
|
||||
*/
|
||||
LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfOwnerCount, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccountTxnID, soeOPTIONAL},
|
||||
{sfRegularKey, soeOPTIONAL},
|
||||
{sfEmailHash, soeOPTIONAL},
|
||||
{sfWalletLocator, soeOPTIONAL},
|
||||
{sfWalletSize, soeOPTIONAL},
|
||||
{sfMessageKey, soeOPTIONAL},
|
||||
{sfTransferRate, soeOPTIONAL},
|
||||
{sfDomain, soeOPTIONAL},
|
||||
{sfTickSize, soeOPTIONAL},
|
||||
{sfTicketCount, soeOPTIONAL},
|
||||
{sfNFTokenMinter, soeOPTIONAL},
|
||||
{sfMintedNFTokens, soeDEFAULT},
|
||||
{sfBurnedNFTokens, soeDEFAULT},
|
||||
{sfFirstNFTokenSequence, soeOPTIONAL},
|
||||
{sfAMMID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfVaultID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfLoanBrokerID, soeOPTIONAL}, // pseudo-account designator
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfBalance, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerCount, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfAccountTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfRegularKey, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfEmailHash, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfWalletLocator, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfWalletSize, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfMessageKey, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfTransferRate, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfDomain, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfTickSize, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfTicketCount, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfNFTokenMinter, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfMintedNFTokens, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfBurnedNFTokens, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfFirstNFTokenSequence, soeOPTIONAL, soeCONSTANT},
|
||||
{sfAMMID, soeOPTIONAL, soeCONSTANT}, // pseudo-account designator
|
||||
{sfVaultID, soeOPTIONAL, soeCONSTANT}, // pseudo-account designator
|
||||
{sfLoanBrokerID, soeOPTIONAL, soeCONSTANT}, // pseudo-account designator
|
||||
}))
|
||||
|
||||
/** A ledger object which contains a list of object identifiers.
|
||||
@@ -158,22 +158,22 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
||||
keylet::ownerDir
|
||||
*/
|
||||
LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
||||
{sfOwner, soeOPTIONAL}, // for owner directories
|
||||
{sfTakerPaysCurrency, soeOPTIONAL}, // order book directories
|
||||
{sfTakerPaysIssuer, soeOPTIONAL}, // order book directories
|
||||
{sfTakerPaysMPT, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsCurrency, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsIssuer, soeOPTIONAL}, // order book directories
|
||||
{sfTakerGetsMPT, soeOPTIONAL}, // order book directories
|
||||
{sfExchangeRate, soeOPTIONAL}, // order book directories
|
||||
{sfIndexes, soeREQUIRED},
|
||||
{sfRootIndex, soeREQUIRED},
|
||||
{sfIndexNext, soeOPTIONAL},
|
||||
{sfIndexPrevious, soeOPTIONAL},
|
||||
{sfNFTokenID, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfDomainID, soeOPTIONAL} // order book directories
|
||||
{sfOwner, soeOPTIONAL, soeCONSTANT}, // for owner directories
|
||||
{sfTakerPaysCurrency, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfTakerPaysIssuer, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfTakerPaysMPT, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfTakerGetsCurrency, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfTakerGetsIssuer, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfTakerGetsMPT, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfExchangeRate, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
{sfIndexes, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfRootIndex, soeREQUIRED, soeCONSTANT},
|
||||
{sfIndexNext, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfIndexPrevious, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfNFTokenID, soeOPTIONAL, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfDomainID, soeOPTIONAL, soeCONSTANT}, // order book directories
|
||||
}))
|
||||
|
||||
/** The ledger object which lists details about amendments on the network.
|
||||
@@ -183,10 +183,10 @@ LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
||||
\sa keylet::amendments
|
||||
*/
|
||||
LEDGER_ENTRY(ltAMENDMENTS, 0x0066, Amendments, amendments, ({
|
||||
{sfAmendments, soeOPTIONAL}, // Enabled
|
||||
{sfMajorities, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfAmendments, soeOPTIONAL, soeNOTCONSTANT}, // Enabled
|
||||
{sfMajorities, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object that contains a list of ledger hashes.
|
||||
@@ -198,9 +198,9 @@ LEDGER_ENTRY(ltAMENDMENTS, 0x0066, Amendments, amendments, ({
|
||||
\sa keylet::skip
|
||||
*/
|
||||
LEDGER_ENTRY(ltLEDGER_HASHES, 0x0068, LedgerHashes, hashes, ({
|
||||
{sfFirstLedgerSequence, soeOPTIONAL},
|
||||
{sfLastLedgerSequence, soeOPTIONAL},
|
||||
{sfHashes, soeREQUIRED},
|
||||
{sfFirstLedgerSequence, soeOPTIONAL, soeCONSTANT},
|
||||
{sfLastLedgerSequence, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfHashes, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** The ledger object which lists details about sidechains.
|
||||
@@ -208,16 +208,16 @@ LEDGER_ENTRY(ltLEDGER_HASHES, 0x0068, LedgerHashes, hashes, ({
|
||||
\sa keylet::bridge
|
||||
*/
|
||||
LEDGER_ENTRY(ltBRIDGE, 0x0069, Bridge, bridge, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfMinAccountCreateAmount, soeOPTIONAL},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfXChainAccountClaimCount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignatureReward, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfMinAccountCreateAmount, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainClaimID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfXChainAccountClaimCount, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes an offer on the DEX.
|
||||
@@ -225,18 +225,18 @@ LEDGER_ENTRY(ltBRIDGE, 0x0069, Bridge, bridge, ({
|
||||
\sa keylet::offer
|
||||
*/
|
||||
LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfTakerPays, soeREQUIRED},
|
||||
{sfTakerGets, soeREQUIRED},
|
||||
{sfBookDirectory, soeREQUIRED},
|
||||
{sfBookNode, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfDomainID, soeOPTIONAL},
|
||||
{sfAdditionalBooks, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfTakerPays, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfTakerGets, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfBookDirectory, soeREQUIRED, soeCONSTANT},
|
||||
{sfBookNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfExpiration, soeOPTIONAL, soeCONSTANT},
|
||||
{sfDomainID, soeOPTIONAL, soeCONSTANT},
|
||||
{sfAdditionalBooks, soeOPTIONAL, soeCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a deposit pre-authorization.
|
||||
@@ -244,12 +244,12 @@ LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
||||
\sa keylet::depositPreauth
|
||||
*/
|
||||
LEDGER_ENTRY_DUPLICATE(ltDEPOSIT_PREAUTH, 0x0070, DepositPreauth, deposit_preauth, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAuthorize, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAuthorizeCredentials, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAuthorize, soeOPTIONAL, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfAuthorizeCredentials, soeOPTIONAL, soeCONSTANT},
|
||||
}))
|
||||
|
||||
/** A claim id for a cross chain transaction.
|
||||
@@ -257,15 +257,15 @@ LEDGER_ENTRY_DUPLICATE(ltDEPOSIT_PREAUTH, 0x0070, DepositPreauth, deposit_preaut
|
||||
\sa keylet::xChainClaimID
|
||||
*/
|
||||
LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_claim_id, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfOtherChainSource, soeREQUIRED},
|
||||
{sfXChainClaimAttestations, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainClaimID, soeREQUIRED, soeCONSTANT},
|
||||
{sfOtherChainSource, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainClaimAttestations, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a bidirectional trust line.
|
||||
@@ -275,17 +275,17 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_c
|
||||
\sa keylet::line
|
||||
*/
|
||||
LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfLowLimit, soeREQUIRED},
|
||||
{sfHighLimit, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfLowNode, soeOPTIONAL},
|
||||
{sfLowQualityIn, soeOPTIONAL},
|
||||
{sfLowQualityOut, soeOPTIONAL},
|
||||
{sfHighNode, soeOPTIONAL},
|
||||
{sfHighQualityIn, soeOPTIONAL},
|
||||
{sfHighQualityOut, soeOPTIONAL},
|
||||
{sfBalance, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfLowLimit, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfHighLimit, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfLowNode, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfLowQualityIn, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfLowQualityOut, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfHighNode, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfHighQualityIn, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfHighQualityOut, soeOPTIONAL, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** The ledger object which lists the network's fee settings.
|
||||
@@ -296,16 +296,16 @@ LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
|
||||
*/
|
||||
LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
|
||||
// Old version uses raw numbers
|
||||
{sfBaseFee, soeOPTIONAL},
|
||||
{sfReferenceFeeUnits, soeOPTIONAL},
|
||||
{sfReserveBase, soeOPTIONAL},
|
||||
{sfReserveIncrement, soeOPTIONAL},
|
||||
{sfBaseFee, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfReferenceFeeUnits, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfReserveBase, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfReserveIncrement, soeOPTIONAL, soeNOTCONSTANT},
|
||||
// New version uses Amounts
|
||||
{sfBaseFeeDrops, soeOPTIONAL},
|
||||
{sfReserveBaseDrops, soeOPTIONAL},
|
||||
{sfReserveIncrementDrops, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfBaseFeeDrops, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfReserveBaseDrops, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfReserveIncrementDrops, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A claim id for a cross chain create account transaction.
|
||||
@@ -313,13 +313,13 @@ LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
|
||||
\sa keylet::xChainCreateAccountClaimID
|
||||
*/
|
||||
LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAccountClaimID, xchain_owned_create_account_claim_id, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfXChainBridge, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfXChainCreateAccountAttestations, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainBridge, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainCreateAccountAttestations, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object describing a single escrow.
|
||||
@@ -327,21 +327,21 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAc
|
||||
\sa keylet::escrow
|
||||
*/
|
||||
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSequence, soeOPTIONAL},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfCondition, soeOPTIONAL},
|
||||
{sfCancelAfter, soeOPTIONAL},
|
||||
{sfFinishAfter, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDestinationNode, soeOPTIONAL},
|
||||
{sfTransferRate, soeOPTIONAL},
|
||||
{sfIssuerNode, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeOPTIONAL, soeCONSTANT},
|
||||
{sfDestination, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfCondition, soeOPTIONAL, soeCONSTANT},
|
||||
{sfCancelAfter, soeOPTIONAL, soeCONSTANT},
|
||||
{sfFinishAfter, soeOPTIONAL, soeCONSTANT},
|
||||
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfDestinationNode, soeOPTIONAL, soeCONSTANT},
|
||||
{sfTransferRate, soeOPTIONAL, soeCONSTANT},
|
||||
{sfIssuerNode, soeOPTIONAL, soeCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object describing a single unidirectional XRP payment channel.
|
||||
@@ -349,21 +349,21 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
||||
\sa keylet::payChan
|
||||
*/
|
||||
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSequence, soeOPTIONAL},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfBalance, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSettleDelay, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfCancelAfter, soeOPTIONAL},
|
||||
{sfSourceTag, soeOPTIONAL},
|
||||
{sfDestinationTag, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDestinationNode, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeOPTIONAL, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfBalance, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfSettleDelay, soeREQUIRED, soeCONSTANT},
|
||||
{sfExpiration, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfCancelAfter, soeOPTIONAL, soeCONSTANT},
|
||||
{sfSourceTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfDestinationTag, soeOPTIONAL, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfDestinationNode, soeOPTIONAL, soeCONSTANT},
|
||||
}))
|
||||
|
||||
/** The ledger object which tracks the AMM.
|
||||
@@ -371,124 +371,124 @@ LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
||||
\sa keylet::amm
|
||||
*/
|
||||
LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfTradingFee, soeDEFAULT},
|
||||
{sfVoteSlots, soeOPTIONAL},
|
||||
{sfAuctionSlot, soeOPTIONAL},
|
||||
{sfLPTokenBalance, soeREQUIRED},
|
||||
{sfAsset, soeREQUIRED},
|
||||
{sfAsset2, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfTradingFee, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfVoteSlots, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfAuctionSlot, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfLPTokenBalance, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfAsset, soeREQUIRED, soeCONSTANT},
|
||||
{sfAsset2, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks MPTokenIssuance
|
||||
\sa keylet::mptIssuance
|
||||
*/
|
||||
LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfTransferFee, soeDEFAULT},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfAssetScale, soeDEFAULT},
|
||||
{sfMaximumAmount, soeOPTIONAL},
|
||||
{sfOutstandingAmount, soeREQUIRED},
|
||||
{sfLockedAmount, soeOPTIONAL},
|
||||
{sfMPTokenMetadata, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfDomainID, soeOPTIONAL},
|
||||
{sfMutableFlags, soeDEFAULT},
|
||||
{sfIssuer, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfTransferFee, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfAssetScale, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfMaximumAmount, soeOPTIONAL, soeCONSTANT},
|
||||
{sfOutstandingAmount, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfLockedAmount, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfMPTokenMetadata, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfDomainID, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfMutableFlags, soeDEFAULT, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks MPToken
|
||||
\sa keylet::mptoken
|
||||
*/
|
||||
LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||
{sfMPTAmount, soeDEFAULT},
|
||||
{sfLockedAmount, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfMPTokenIssuanceID, soeREQUIRED, soeCONSTANT},
|
||||
{sfMPTAmount, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfLockedAmount, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks Oracle
|
||||
\sa keylet::oracle
|
||||
*/
|
||||
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfOracleDocumentID, soeOPTIONAL},
|
||||
{sfProvider, soeREQUIRED},
|
||||
{sfPriceDataSeries, soeREQUIRED},
|
||||
{sfAssetClass, soeREQUIRED},
|
||||
{sfLastUpdateTime, soeREQUIRED},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED, soeCONSTANT},
|
||||
{sfOracleDocumentID, soeOPTIONAL, soeCONSTANT},
|
||||
{sfProvider, soeREQUIRED, soeCONSTANT},
|
||||
{sfPriceDataSeries, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfAssetClass, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfLastUpdateTime, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks Credential
|
||||
\sa keylet::credential
|
||||
*/
|
||||
LEDGER_ENTRY(ltCREDENTIAL, 0x0081, Credential, credential, ({
|
||||
{sfSubject, soeREQUIRED},
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfCredentialType, soeREQUIRED},
|
||||
{sfExpiration, soeOPTIONAL},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfIssuerNode, soeREQUIRED},
|
||||
{sfSubjectNode, soeOPTIONAL},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSubject, soeREQUIRED, soeCONSTANT},
|
||||
{sfIssuer, soeREQUIRED, soeCONSTANT},
|
||||
{sfCredentialType, soeREQUIRED, soeCONSTANT},
|
||||
{sfExpiration, soeOPTIONAL, soeCONSTANT},
|
||||
{sfURI, soeOPTIONAL, soeCONSTANT},
|
||||
{sfIssuerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfSubjectNode, soeOPTIONAL, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks PermissionedDomain
|
||||
\sa keylet::permissionedDomain
|
||||
*/
|
||||
LEDGER_ENTRY(ltPERMISSIONED_DOMAIN, 0x0082, PermissionedDomain, permissioned_domain, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfAcceptedCredentials, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED, soeCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfAcceptedCredentials, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object representing permissions an account has delegated to another account.
|
||||
\sa keylet::delegate
|
||||
*/
|
||||
LEDGER_ENTRY(ltDELEGATE, 0x0083, Delegate, delegate, ({
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAuthorize, soeREQUIRED},
|
||||
{sfPermissions, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAuthorize, soeREQUIRED, soeCONSTANT},
|
||||
{sfPermissions, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object representing a single asset vault.
|
||||
\sa keylet::vault
|
||||
*/
|
||||
LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfData, soeOPTIONAL},
|
||||
{sfAsset, soeREQUIRED},
|
||||
{sfAssetsTotal, soeDEFAULT},
|
||||
{sfAssetsAvailable, soeDEFAULT},
|
||||
{sfAssetsMaximum, soeDEFAULT},
|
||||
{sfLossUnrealized, soeDEFAULT},
|
||||
{sfShareMPTID, soeREQUIRED},
|
||||
{sfWithdrawalPolicy, soeREQUIRED},
|
||||
{sfScale, soeDEFAULT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwner, soeREQUIRED, soeCONSTANT},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfData, soeOPTIONAL, soeNOTCONSTANT},
|
||||
{sfAsset, soeREQUIRED, soeCONSTANT},
|
||||
{sfAssetsTotal, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfAssetsAvailable, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfAssetsMaximum, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfLossUnrealized, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfShareMPTID, soeREQUIRED, soeCONSTANT},
|
||||
{sfWithdrawalPolicy, soeREQUIRED, soeCONSTANT},
|
||||
{sfScale, soeDEFAULT, soeCONSTANT},
|
||||
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
|
||||
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
|
||||
}))
|
||||
@@ -500,23 +500,23 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
\sa keylet::loanbroker
|
||||
*/
|
||||
LEDGER_ENTRY(ltLOAN_BROKER, 0x0088, LoanBroker, loan_broker, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfSequence, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfVaultNode, soeREQUIRED},
|
||||
{sfVaultID, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfLoanSequence, soeREQUIRED},
|
||||
{sfData, soeDEFAULT},
|
||||
{sfManagementFeeRate, soeDEFAULT},
|
||||
{sfOwnerCount, soeDEFAULT},
|
||||
{sfDebtTotal, soeDEFAULT},
|
||||
{sfDebtMaximum, soeDEFAULT},
|
||||
{sfCoverAvailable, soeDEFAULT},
|
||||
{sfCoverRateMinimum, soeDEFAULT},
|
||||
{sfCoverRateLiquidation, soeDEFAULT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfVaultNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfVaultID, soeREQUIRED, soeCONSTANT},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfOwner, soeREQUIRED, soeCONSTANT},
|
||||
{sfLoanSequence, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfData, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfManagementFeeRate, soeDEFAULT, soeCONSTANT},
|
||||
{sfOwnerCount, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfDebtTotal, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfDebtMaximum, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfCoverAvailable, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfCoverRateMinimum, soeDEFAULT, soeCONSTANT},
|
||||
{sfCoverRateLiquidation, soeDEFAULT, soeCONSTANT},
|
||||
}))
|
||||
|
||||
/** A ledger object representing a loan between a Borrower and a Loan Broker
|
||||
@@ -524,27 +524,27 @@ LEDGER_ENTRY(ltLOAN_BROKER, 0x0088, LoanBroker, loan_broker, ({
|
||||
\sa keylet::loan
|
||||
*/
|
||||
LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfLoanBrokerNode, soeREQUIRED},
|
||||
{sfLoanBrokerID, soeREQUIRED},
|
||||
{sfLoanSequence, soeREQUIRED},
|
||||
{sfBorrower, soeREQUIRED},
|
||||
{sfLoanOriginationFee, soeDEFAULT},
|
||||
{sfLoanServiceFee, soeDEFAULT},
|
||||
{sfLatePaymentFee, soeDEFAULT},
|
||||
{sfClosePaymentFee, soeDEFAULT},
|
||||
{sfOverpaymentFee, soeDEFAULT},
|
||||
{sfInterestRate, soeDEFAULT},
|
||||
{sfLateInterestRate, soeDEFAULT},
|
||||
{sfCloseInterestRate, soeDEFAULT},
|
||||
{sfOverpaymentInterestRate, soeDEFAULT},
|
||||
{sfStartDate, soeREQUIRED},
|
||||
{sfPaymentInterval, soeREQUIRED},
|
||||
{sfGracePeriod, soeDEFAULT},
|
||||
{sfPreviousPaymentDueDate, soeDEFAULT},
|
||||
{sfNextPaymentDueDate, soeDEFAULT},
|
||||
{sfPreviousTxnID, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfOwnerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfLoanBrokerNode, soeREQUIRED, soeCONSTANT},
|
||||
{sfLoanBrokerID, soeREQUIRED, soeCONSTANT},
|
||||
{sfLoanSequence, soeREQUIRED, soeCONSTANT},
|
||||
{sfBorrower, soeREQUIRED, soeCONSTANT},
|
||||
{sfLoanOriginationFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfLoanServiceFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfLatePaymentFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfClosePaymentFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfOverpaymentFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfInterestRate, soeDEFAULT, soeCONSTANT},
|
||||
{sfLateInterestRate, soeDEFAULT, soeCONSTANT},
|
||||
{sfCloseInterestRate, soeDEFAULT, soeCONSTANT},
|
||||
{sfOverpaymentInterestRate, soeDEFAULT, soeCONSTANT},
|
||||
{sfStartDate, soeREQUIRED, soeCONSTANT},
|
||||
{sfPaymentInterval, soeREQUIRED, soeCONSTANT},
|
||||
{sfGracePeriod, soeDEFAULT, soeCONSTANT},
|
||||
{sfPreviousPaymentDueDate, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfNextPaymentDueDate, soeDEFAULT, soeNOTCONSTANT},
|
||||
// The loan object tracks these values:
|
||||
//
|
||||
// - PaymentRemaining: The number of payments left in the loan. When it
|
||||
@@ -592,17 +592,17 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
||||
//
|
||||
// Note the the "True" values may differ significantly from the tracked
|
||||
// rounded values.
|
||||
{sfPaymentRemaining, soeDEFAULT},
|
||||
{sfPeriodicPayment, soeREQUIRED},
|
||||
{sfPrincipalOutstanding, soeDEFAULT},
|
||||
{sfTotalValueOutstanding, soeDEFAULT},
|
||||
{sfManagementFeeOutstanding, soeDEFAULT},
|
||||
{sfPaymentRemaining, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfPeriodicPayment, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfPrincipalOutstanding, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfTotalValueOutstanding, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfManagementFeeOutstanding, soeDEFAULT, soeNOTCONSTANT},
|
||||
// Based on the computed total value at creation, used for
|
||||
// rounding calculated values so they are all on a
|
||||
// consistent scale - that is, they all have the same
|
||||
// number of digits after the decimal point (excluding
|
||||
// trailing zeros).
|
||||
{sfLoanScale, soeDEFAULT},
|
||||
{sfLoanScale, soeDEFAULT, soeCONSTANT},
|
||||
}))
|
||||
|
||||
#undef EXPAND
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#include <xrpl/rdb/DBInit.h>
|
||||
#include <xrpl/rdb/SociDB.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -71,7 +72,7 @@ public:
|
||||
|
||||
StartUpType startUp = StartUpType::Normal;
|
||||
bool standAlone = false;
|
||||
std::filesystem::path dataDir;
|
||||
boost::filesystem::path dataDir;
|
||||
// Indicates whether or not to return the `globalPragma`
|
||||
// from commonPragma()
|
||||
bool useGlobalPragma = false;
|
||||
@@ -134,7 +135,7 @@ public:
|
||||
|
||||
template <std::size_t N, std::size_t M>
|
||||
DatabaseCon(
|
||||
std::filesystem::path const& dataDir,
|
||||
boost::filesystem::path const& dataDir,
|
||||
std::string const& dbName,
|
||||
std::array<std::string, N> const& pragma,
|
||||
std::array<char const*, M> const& initSQL,
|
||||
@@ -146,7 +147,7 @@ public:
|
||||
// Use this constructor to setup checkpointing
|
||||
template <std::size_t N, std::size_t M>
|
||||
DatabaseCon(
|
||||
std::filesystem::path const& dataDir,
|
||||
boost::filesystem::path const& dataDir,
|
||||
std::string const& dbName,
|
||||
std::array<std::string, N> const& pragma,
|
||||
std::array<char const*, M> const& initSQL,
|
||||
@@ -181,7 +182,7 @@ private:
|
||||
|
||||
template <std::size_t N, std::size_t M>
|
||||
DatabaseCon(
|
||||
std::filesystem::path const& pPath,
|
||||
boost::filesystem::path const& pPath,
|
||||
std::vector<std::string> const* commonPragma,
|
||||
std::array<std::string, N> const& pragma,
|
||||
std::array<char const*, M> const& initSQL,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <xrpl/protocol/TxSearched.h>
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
#include <xrpl/server/Manifest.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
struct SavedState
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
#include <xrpl/basics/contract.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
void
|
||||
extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst)
|
||||
extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst)
|
||||
{
|
||||
if (!is_regular_file(src))
|
||||
Throw<std::runtime_error>("Invalid source file");
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
#include <xrpl/basics/FileUtilities.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/system/detail/errc.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
#include <boost/system/errc.hpp>
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
std::string
|
||||
getFileContents(
|
||||
std::error_code& ec,
|
||||
std::filesystem::path const& sourcePath,
|
||||
boost::system::error_code& ec,
|
||||
boost::filesystem::path const& sourcePath,
|
||||
std::optional<std::size_t> maxSize)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
using namespace boost::system::errc;
|
||||
|
||||
path const fullPath{canonical(sourcePath, ec)};
|
||||
if (ec)
|
||||
@@ -27,15 +32,15 @@ getFileContents(
|
||||
if (maxSize && (file_size(fullPath, ec) > *maxSize || ec))
|
||||
{
|
||||
if (!ec)
|
||||
ec = make_error_code(std::errc::file_too_large);
|
||||
ec = make_error_code(file_too_large);
|
||||
return {};
|
||||
}
|
||||
|
||||
std::ifstream fileStream(fullPath, std::ios::in);
|
||||
std::ifstream fileStream(fullPath.string(), std::ios::in);
|
||||
|
||||
if (!fileStream)
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
ec = make_error_code(static_cast<errc_t>(errno));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -44,7 +49,7 @@ getFileContents(
|
||||
|
||||
if (fileStream.bad())
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
ec = make_error_code(static_cast<errc_t>(errno));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -53,15 +58,18 @@ getFileContents(
|
||||
|
||||
void
|
||||
writeFileContents(
|
||||
std::error_code& ec,
|
||||
std::filesystem::path const& destPath,
|
||||
boost::system::error_code& ec,
|
||||
boost::filesystem::path const& destPath,
|
||||
std::string const& contents)
|
||||
{
|
||||
std::ofstream fileStream(destPath, std::ios::out | std::ios::trunc);
|
||||
using namespace boost::filesystem;
|
||||
using namespace boost::system::errc;
|
||||
|
||||
std::ofstream fileStream(destPath.string(), std::ios::out | std::ios::trunc);
|
||||
|
||||
if (!fileStream)
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
ec = make_error_code(static_cast<errc_t>(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +77,7 @@ writeFileContents(
|
||||
|
||||
if (fileStream.bad())
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
ec = make_error_code(static_cast<errc_t>(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
@@ -53,7 +53,7 @@ Logs::File::isOpen() const noexcept
|
||||
}
|
||||
|
||||
bool
|
||||
Logs::File::open(std::filesystem::path const& path)
|
||||
Logs::File::open(boost::filesystem::path const& path)
|
||||
{
|
||||
close();
|
||||
|
||||
@@ -112,7 +112,7 @@ Logs::Logs(beast::severities::Severity thresh) : thresh_(thresh) // default sev
|
||||
}
|
||||
|
||||
bool
|
||||
Logs::open(std::filesystem::path const& pathToLogFile)
|
||||
Logs::open(boost::filesystem::path const& pathToLogFile)
|
||||
{
|
||||
return file_.open(pathToLogFile);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <xrpl/nodestore/detail/EncodedBlob.h>
|
||||
#include <xrpl/nodestore/detail/codec.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/system/detail/errc.hpp>
|
||||
|
||||
#include <nudb/context.hpp>
|
||||
@@ -33,14 +35,12 @@
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
void
|
||||
open(bool createIfMissing, uint64_t appType, uint64_t uid, uint64_t salt) override
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (db_.is_open())
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
@@ -194,12 +194,11 @@ public:
|
||||
|
||||
if (deletePath_)
|
||||
{
|
||||
std::error_code fsec;
|
||||
std::filesystem::remove_all(name_, fsec);
|
||||
if (fsec)
|
||||
boost::filesystem::remove_all(name_, ec);
|
||||
if (ec)
|
||||
{
|
||||
JLOG(j_.fatal()) << "Filesystem remove_all of " << name_
|
||||
<< " failed with: " << fsec.message();
|
||||
JLOG(j_.fatal())
|
||||
<< "Filesystem remove_all of " << name_ << " failed with: " << ec.message();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,7 +374,7 @@ private:
|
||||
static std::size_t
|
||||
parseBlockSize(std::string const& name, Section const& keyValues, beast::Journal journal)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
auto const folder = path(name);
|
||||
auto const kp = (folder / "nudb.key").string();
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include <xrpl/nodestore/Scheduler.h>
|
||||
#include <xrpl/nodestore/Types.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <rocksdb/advanced_options.h>
|
||||
#include <rocksdb/cache.h>
|
||||
#include <rocksdb/compression_type.h>
|
||||
@@ -23,7 +26,6 @@
|
||||
|
||||
#include <bit>
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@@ -263,8 +265,8 @@ public:
|
||||
m_db.reset();
|
||||
if (m_deletePath)
|
||||
{
|
||||
std::filesystem::path const dir = m_name;
|
||||
std::filesystem::remove_all(dir);
|
||||
boost::filesystem::path const dir = m_name;
|
||||
boost::filesystem::remove_all(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,152 +13,154 @@ InnerObjectFormats::InnerObjectFormats()
|
||||
add(sfSignerEntry.jsonName,
|
||||
sfSignerEntry.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSignerWeight, soeREQUIRED},
|
||||
{sfWalletLocator, soeOPTIONAL},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignerWeight, soeREQUIRED, soeNOTCONSTANT},
|
||||
{sfWalletLocator, soeOPTIONAL, soeNOTCONSTANT},
|
||||
});
|
||||
|
||||
add(sfSigner.jsonName,
|
||||
sfSigner.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSigningPubKey, soeREQUIRED},
|
||||
{sfTxnSignature, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSigningPubKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfTxnSignature, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfMajority.jsonName,
|
||||
sfMajority.getCode(),
|
||||
{
|
||||
{sfAmendment, soeREQUIRED},
|
||||
{sfCloseTime, soeREQUIRED},
|
||||
{sfAmendment, soeREQUIRED, soeCONSTANT},
|
||||
{sfCloseTime, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfDisabledValidator.jsonName,
|
||||
sfDisabledValidator.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfFirstLedgerSequence, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfFirstLedgerSequence, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfNFToken.jsonName,
|
||||
sfNFToken.getCode(),
|
||||
{
|
||||
{sfNFTokenID, soeREQUIRED},
|
||||
{sfURI, soeOPTIONAL},
|
||||
{sfNFTokenID, soeREQUIRED, soeCONSTANT},
|
||||
{sfURI, soeOPTIONAL, soeNOTCONSTANT},
|
||||
});
|
||||
|
||||
add(sfVoteEntry.jsonName,
|
||||
sfVoteEntry.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfTradingFee, soeDEFAULT},
|
||||
{sfVoteWeight, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfTradingFee, soeDEFAULT, soeNOTCONSTANT},
|
||||
{sfVoteWeight, soeREQUIRED, soeNOTCONSTANT},
|
||||
});
|
||||
|
||||
add(sfAuctionSlot.jsonName,
|
||||
sfAuctionSlot.getCode(),
|
||||
{{sfAccount, soeREQUIRED},
|
||||
{sfExpiration, soeREQUIRED},
|
||||
{sfDiscountedFee, soeDEFAULT},
|
||||
{sfPrice, soeREQUIRED},
|
||||
{sfAuthAccounts, soeOPTIONAL}});
|
||||
{{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfExpiration, soeREQUIRED, soeCONSTANT},
|
||||
{sfDiscountedFee, soeDEFAULT, soeCONSTANT},
|
||||
{sfPrice, soeREQUIRED, soeCONSTANT},
|
||||
{sfAuthAccounts, soeOPTIONAL, soeCONSTANT}});
|
||||
|
||||
add(sfXChainClaimAttestationCollectionElement.jsonName,
|
||||
sfXChainClaimAttestationCollectionElement.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSignature, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignature, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainClaimID, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeOPTIONAL, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfXChainCreateAccountAttestationCollectionElement.jsonName,
|
||||
sfXChainCreateAccountAttestationCollectionElement.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSignature, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignature, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfXChainClaimProofSig.jsonName,
|
||||
sfXChainClaimProofSig.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeOPTIONAL, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfXChainCreateAccountProofSig.jsonName,
|
||||
sfXChainCreateAccountProofSig.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfAttestationSignerAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfPublicKey, soeREQUIRED, soeCONSTANT},
|
||||
{sfAmount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSignatureReward, soeREQUIRED, soeCONSTANT},
|
||||
{sfAttestationRewardAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfWasLockingChainSend, soeREQUIRED, soeCONSTANT},
|
||||
{sfDestination, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfAuthAccount.jsonName,
|
||||
sfAuthAccount.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfPriceData.jsonName,
|
||||
sfPriceData.getCode(),
|
||||
{
|
||||
{sfBaseAsset, soeREQUIRED},
|
||||
{sfQuoteAsset, soeREQUIRED},
|
||||
{sfAssetPrice, soeOPTIONAL},
|
||||
{sfScale, soeDEFAULT},
|
||||
{sfBaseAsset, soeREQUIRED, soeCONSTANT},
|
||||
{sfQuoteAsset, soeREQUIRED, soeCONSTANT},
|
||||
{sfAssetPrice, soeOPTIONAL, soeCONSTANT},
|
||||
{sfScale, soeDEFAULT, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfCredential.jsonName,
|
||||
sfCredential.getCode(),
|
||||
{
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfCredentialType, soeREQUIRED},
|
||||
{sfIssuer, soeREQUIRED, soeCONSTANT},
|
||||
{sfCredentialType, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfPermission.jsonName.c_str(), sfPermission.getCode(), {{sfPermissionValue, soeREQUIRED}});
|
||||
add(sfPermission.jsonName.c_str(),
|
||||
sfPermission.getCode(),
|
||||
{{sfPermissionValue, soeREQUIRED, soeCONSTANT}});
|
||||
|
||||
add(sfBatchSigner.jsonName.c_str(),
|
||||
sfBatchSigner.getCode(),
|
||||
{{sfAccount, soeREQUIRED},
|
||||
{sfSigningPubKey, soeOPTIONAL},
|
||||
{sfTxnSignature, soeOPTIONAL},
|
||||
{sfSigners, soeOPTIONAL}});
|
||||
{{sfAccount, soeREQUIRED, soeCONSTANT},
|
||||
{sfSigningPubKey, soeOPTIONAL, soeCONSTANT},
|
||||
{sfTxnSignature, soeOPTIONAL, soeCONSTANT},
|
||||
{sfSigners, soeOPTIONAL, soeCONSTANT}});
|
||||
|
||||
add(sfBook.jsonName,
|
||||
sfBook.getCode(),
|
||||
{
|
||||
{sfBookDirectory, soeREQUIRED},
|
||||
{sfBookNode, soeREQUIRED},
|
||||
{sfBookDirectory, soeREQUIRED, soeCONSTANT},
|
||||
{sfBookNode, soeREQUIRED, soeCONSTANT},
|
||||
});
|
||||
|
||||
add(sfCounterpartySignature.jsonName,
|
||||
sfCounterpartySignature.getCode(),
|
||||
{
|
||||
{sfSigningPubKey, soeOPTIONAL},
|
||||
{sfTxnSignature, soeOPTIONAL},
|
||||
{sfSigners, soeOPTIONAL},
|
||||
{sfSigningPubKey, soeOPTIONAL, soeCONSTANT},
|
||||
{sfTxnSignature, soeOPTIONAL, soeCONSTANT},
|
||||
{sfSigners, soeOPTIONAL, soeCONSTANT},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ std::vector<SOElement> const&
|
||||
LedgerFormats::getCommonFields()
|
||||
{
|
||||
static auto const commonFields = std::vector<SOElement>{
|
||||
{sfLedgerIndex, soeOPTIONAL},
|
||||
{sfLedgerEntryType, soeREQUIRED},
|
||||
{sfFlags, soeREQUIRED},
|
||||
{sfLedgerIndex, soeOPTIONAL, soeCONSTANT},
|
||||
{sfLedgerEntryType, soeREQUIRED, soeCONSTANT},
|
||||
{sfFlags, soeREQUIRED, soeNOTCONSTANT},
|
||||
};
|
||||
return commonFields;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
#include <xrpl/core/JobQueue.h>
|
||||
#include <xrpl/core/ServiceRegistry.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <soci/blob.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@@ -42,8 +44,8 @@ getSociSqliteInit(std::string const& name, std::string const& dir, std::string c
|
||||
Throw<std::runtime_error>(
|
||||
"Sqlite databases must specify a dir and a name. Name: " + name + " Dir: " + dir);
|
||||
}
|
||||
std::filesystem::path file(dir);
|
||||
if (std::filesystem::is_directory(file))
|
||||
boost::filesystem::path file(dir);
|
||||
if (is_directory(file))
|
||||
file /= name + ext;
|
||||
return file.string();
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
#include <xrpl/rdb/DBInit.h>
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/format.hpp> // IWYU pragma: keep
|
||||
|
||||
#include <soci/into.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
@@ -19,7 +20,7 @@ namespace xrpl {
|
||||
bool
|
||||
doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j)
|
||||
{
|
||||
std::filesystem::path const dbPath = setup.dataDir / TxDBName;
|
||||
boost::filesystem::path const dbPath = setup.dataDir / TxDBName;
|
||||
|
||||
uintmax_t const dbSize = file_size(dbPath);
|
||||
XRPL_ASSERT(dbSize != static_cast<uintmax_t>(-1), "xrpl::doVacuumDB : file_size succeeded");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <xrpl/protocol/MPTIssue.h>
|
||||
#include <xrpl/protocol/Protocol.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/SOTemplate.h>
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STNumber.h> // IWYU pragma: keep
|
||||
@@ -945,6 +946,49 @@ NoModifiedUnmodifiableFields::visitEntry(
|
||||
changedEntries_.emplace(before, after);
|
||||
}
|
||||
|
||||
// Check whether any constant (or unannotated) fields in the given template
|
||||
// have been modified between before and after. Recurses into STObject and
|
||||
// STArray fields using InnerObjectFormats.
|
||||
static bool
|
||||
hasConstantFieldChanged(STObject const& before, STObject const& after, SOTemplate const& tmpl)
|
||||
{
|
||||
for (auto const& elem : tmpl)
|
||||
{
|
||||
auto const& sf = elem.sField();
|
||||
auto const constant = elem.constant();
|
||||
|
||||
auto const* bField = before.peekAtPField(sf);
|
||||
auto const* aField = after.peekAtPField(sf);
|
||||
bool const bPresent = (bField != nullptr) && bField->getSType() != STI_NOTPRESENT;
|
||||
bool const aPresent = (aField != nullptr) && aField->getSType() != STI_NOTPRESENT;
|
||||
|
||||
XRPL_ASSERT(
|
||||
constant != soeCONSTANTINVALID, "xrpl::hasConstantFieldChanged : constant is invalid");
|
||||
if (constant == soeCONSTANT)
|
||||
{
|
||||
if (elem.style() == soeOPTIONAL)
|
||||
{
|
||||
// Optional constant fields may be added or removed,
|
||||
// but their value must not change once present.
|
||||
if (bPresent && aPresent && *bField != *aField)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Required and default constant fields must not
|
||||
// change at all — including transitions between
|
||||
// default (not-present) and explicit values.
|
||||
if (bPresent != aPresent || (bPresent && aPresent && *bField != *aField))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// soeNOTCONSTANT fields may change freely — no recursion
|
||||
// into inner objects/arrays is needed because the parent
|
||||
// field explicitly allows changes to its entire contents.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
NoModifiedUnmodifiableFields::finalize(
|
||||
STTx const& tx,
|
||||
@@ -958,23 +1002,37 @@ NoModifiedUnmodifiableFields::finalize(
|
||||
bool const afterField = after->isFieldPresent(field);
|
||||
return beforeField != afterField || (afterField && before->at(field) != after->at(field));
|
||||
};
|
||||
|
||||
bool const useTemplate = view.rules().enabled(featureInvariantsV1_1);
|
||||
|
||||
for (auto const& slePair : changedEntries_)
|
||||
{
|
||||
auto const& before = slePair.first;
|
||||
auto const& after = slePair.second;
|
||||
auto const type = after->getType();
|
||||
|
||||
// New template-based check
|
||||
bool bad = false;
|
||||
[[maybe_unused]] bool enforce = false;
|
||||
{
|
||||
auto const* format = LedgerFormats::getInstance().findByType(type);
|
||||
if (format != nullptr)
|
||||
bad = hasConstantFieldChanged(*before, *after, format->getSOTemplate());
|
||||
|
||||
// sfLedgerIndex is a non-serialized (discardable) field
|
||||
// that is not reliably present via peekAtPField, so we
|
||||
// check it explicitly.
|
||||
if (!bad)
|
||||
bad = fieldChanged(before, after, sfLedgerIndex);
|
||||
}
|
||||
|
||||
// Old hardcoded check
|
||||
bool badOld = false;
|
||||
[[maybe_unused]] bool enforceOld = false;
|
||||
switch (type)
|
||||
{
|
||||
case ltLOAN_BROKER:
|
||||
/*
|
||||
* We check this invariant regardless of lending protocol
|
||||
* amendment status, allowing for detection and logging of
|
||||
* potential issues even when the amendment is disabled.
|
||||
*/
|
||||
enforce = view.rules().enabled(featureLendingProtocol);
|
||||
bad = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
enforceOld = view.rules().enabled(featureLendingProtocol);
|
||||
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
fieldChanged(before, after, sfLedgerIndex) ||
|
||||
fieldChanged(before, after, sfSequence) ||
|
||||
fieldChanged(before, after, sfOwnerNode) ||
|
||||
@@ -987,13 +1045,8 @@ NoModifiedUnmodifiableFields::finalize(
|
||||
fieldChanged(before, after, sfCoverRateLiquidation);
|
||||
break;
|
||||
case ltLOAN:
|
||||
/*
|
||||
* We check this invariant regardless of lending protocol
|
||||
* amendment status, allowing for detection and logging of
|
||||
* potential issues even when the amendment is disabled.
|
||||
*/
|
||||
enforce = view.rules().enabled(featureLendingProtocol);
|
||||
bad = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
enforceOld = view.rules().enabled(featureLendingProtocol);
|
||||
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
fieldChanged(before, after, sfLedgerIndex) ||
|
||||
fieldChanged(before, after, sfSequence) ||
|
||||
fieldChanged(before, after, sfOwnerNode) ||
|
||||
@@ -1015,28 +1068,28 @@ NoModifiedUnmodifiableFields::finalize(
|
||||
fieldChanged(before, after, sfLoanScale);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* We check this invariant regardless of lending protocol
|
||||
* amendment status, allowing for detection and logging of
|
||||
* potential issues even when the amendment is disabled.
|
||||
*
|
||||
* We use the lending protocol as a gate, even though
|
||||
* all transactions are affected because that's when it
|
||||
* was added.
|
||||
*/
|
||||
enforce = view.rules().enabled(featureLendingProtocol);
|
||||
bad = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
enforceOld = view.rules().enabled(featureLendingProtocol);
|
||||
badOld = fieldChanged(before, after, sfLedgerEntryType) ||
|
||||
fieldChanged(before, after, sfLedgerIndex);
|
||||
}
|
||||
XRPL_ASSERT(
|
||||
!bad || enforce,
|
||||
"xrpl::NoModifiedUnmodifiableFields::finalize : no bad "
|
||||
"changes or enforce invariant");
|
||||
|
||||
if (bad)
|
||||
{
|
||||
JLOG(j.fatal()) << "Invariant failed: changed an unchangeable field for "
|
||||
<< tx.getTransactionID();
|
||||
if (enforce)
|
||||
if (useTemplate)
|
||||
return false;
|
||||
}
|
||||
|
||||
XRPL_ASSERT(
|
||||
!badOld || enforceOld,
|
||||
"xrpl::NoModifiedUnmodifiableFields::finalize : no bad "
|
||||
"changes or enforce invariant");
|
||||
if (badOld)
|
||||
{
|
||||
JLOG(j.fatal()) << "Invariant failed: changed an unchangeable field for "
|
||||
<< tx.getTransactionID();
|
||||
if (!useTemplate && enforceOld)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <xrpl/proto/org/xrpl/rpc/v1/get_ledger.pb.h>
|
||||
#include <xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.grpc.pb.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <grpcpp/client_context.h>
|
||||
#include <grpcpp/create_channel.h>
|
||||
#include <grpcpp/grpcpp.h>
|
||||
@@ -14,14 +16,9 @@
|
||||
#include <grpcpp/support/status.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -259,23 +256,9 @@ public:
|
||||
TemporaryTLSCertificates()
|
||||
{
|
||||
auto tmpDir = std::filesystem::temp_directory_path();
|
||||
std::random_device rd;
|
||||
constexpr std::size_t maxAttempts = 100;
|
||||
for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt)
|
||||
{
|
||||
std::error_code ec;
|
||||
std::ostringstream oss;
|
||||
oss << kCERTS_DIR_PREFIX << std::hex << std::setfill('0') << std::setw(8) << rd();
|
||||
tempDir_ = tmpDir / oss.str();
|
||||
if (!std::filesystem::exists(tempDir_, ec) && !ec)
|
||||
break;
|
||||
tempDir_.clear();
|
||||
}
|
||||
if (tempDir_.empty())
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Unable to generate a unique temporary TLS certificate directory");
|
||||
}
|
||||
auto uniqueDirName =
|
||||
boost::filesystem::unique_path(std::string(kCERTS_DIR_PREFIX) + "%%%%%%%%");
|
||||
tempDir_ = tmpDir / uniqueDirName.string();
|
||||
std::filesystem::create_directories(tempDir_);
|
||||
|
||||
writeFile(tempDir_ / kCA_CERT_FILENAME, kCA_CERT_CONTENT);
|
||||
|
||||
@@ -2108,10 +2108,12 @@ class Invariants_test : public beast::unit_test::suite
|
||||
|
||||
// TODO: Loan Object
|
||||
|
||||
// Template-based checks: common constant fields on AccountRoot
|
||||
{
|
||||
auto const mods = std::to_array<std::function<void(SLE::pointer&)>>({
|
||||
[](SLE::pointer& sle) { sle->at(sfLedgerEntryType) += 1; },
|
||||
[](SLE::pointer& sle) { sle->at(sfLedgerIndex) = uint256(1u); },
|
||||
[](SLE::pointer& sle) { sle->at(sfAccount) = Account("other").id(); },
|
||||
});
|
||||
|
||||
for (auto const& mod : mods)
|
||||
@@ -2128,6 +2130,69 @@ class Invariants_test : public beast::unit_test::suite
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Template-based checks: soeNOTCONSTANT field
|
||||
// (sfPreviousTxnID) on AccountRoot should NOT fail when
|
||||
// modified — no invariant checks this field.
|
||||
{
|
||||
doInvariantCheck(
|
||||
{},
|
||||
[&](Account const& A1, Account const&, ApplyContext& ac) {
|
||||
auto sle = ac.view().peek(keylet::account(A1.id()));
|
||||
if (!sle)
|
||||
return false;
|
||||
sle->at(sfPreviousTxnID) = uint256(42u);
|
||||
ac.view().update(sle);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttACCOUNT_SET, [](STObject&) {}},
|
||||
{tesSUCCESS, tesSUCCESS});
|
||||
}
|
||||
|
||||
// Without featureInvariantsV1_1, old hardcoded path should
|
||||
// still catch sfLedgerEntryType/sfLedgerIndex changes
|
||||
{
|
||||
auto const mods = std::to_array<std::function<void(SLE::pointer&)>>({
|
||||
[](SLE::pointer& sle) { sle->at(sfLedgerEntryType) += 1; },
|
||||
[](SLE::pointer& sle) { sle->at(sfLedgerIndex) = uint256(1u); },
|
||||
});
|
||||
|
||||
for (auto const& mod : mods)
|
||||
{
|
||||
doInvariantCheck(
|
||||
Env(*this, defaultAmendments() - featureInvariantsV1_1),
|
||||
{{"changed an unchangeable field"}},
|
||||
[&](Account const& A1, Account const&, ApplyContext& ac) {
|
||||
auto sle = ac.view().peek(keylet::account(A1.id()));
|
||||
if (!sle)
|
||||
return false;
|
||||
mod(sle);
|
||||
ac.view().update(sle);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Without featureInvariantsV1_1, modifying a soeCONSTANT field
|
||||
// that is NOT sfLedgerEntryType/sfLedgerIndex on a non-loan
|
||||
// type should NOT fail (old code doesn't check it)
|
||||
{
|
||||
doInvariantCheck(
|
||||
Env(*this, defaultAmendments() - featureInvariantsV1_1),
|
||||
{},
|
||||
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
|
||||
auto sle = ac.view().peek(keylet::account(A1.id()));
|
||||
if (!sle)
|
||||
return false;
|
||||
sle->at(sfAccount) = A2.id();
|
||||
ac.view().update(sle);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttACCOUNT_SET, [](STObject&) {}},
|
||||
{tesSUCCESS, tesSUCCESS});
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2924,7 +2989,7 @@ class Invariants_test : public beast::unit_test::suite
|
||||
TxAccount::A2);
|
||||
|
||||
doInvariantCheck(
|
||||
{"violation of vault immutable data"},
|
||||
{"violation of vault immutable data", "changed an unchangeable field"},
|
||||
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
|
||||
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
|
||||
auto sleVault = ac.view().peek(keylet);
|
||||
@@ -2936,11 +3001,11 @@ class Invariants_test : public beast::unit_test::suite
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttVAULT_SET, [](STObject& tx) {}},
|
||||
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
|
||||
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
|
||||
precloseXrp);
|
||||
|
||||
doInvariantCheck(
|
||||
{"violation of vault immutable data"},
|
||||
{"violation of vault immutable data", "changed an unchangeable field"},
|
||||
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
|
||||
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
|
||||
auto sleVault = ac.view().peek(keylet);
|
||||
@@ -2952,11 +3017,11 @@ class Invariants_test : public beast::unit_test::suite
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttVAULT_SET, [](STObject& tx) {}},
|
||||
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
|
||||
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
|
||||
precloseXrp);
|
||||
|
||||
doInvariantCheck(
|
||||
{"violation of vault immutable data"},
|
||||
{"violation of vault immutable data", "changed an unchangeable field"},
|
||||
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
|
||||
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
|
||||
auto sleVault = ac.view().peek(keylet);
|
||||
@@ -2968,7 +3033,7 @@ class Invariants_test : public beast::unit_test::suite
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttVAULT_SET, [](STObject& tx) {}},
|
||||
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
|
||||
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
|
||||
precloseXrp);
|
||||
|
||||
doInvariantCheck(
|
||||
@@ -3233,7 +3298,8 @@ class Invariants_test : public beast::unit_test::suite
|
||||
{"create operation must not have updated a vault",
|
||||
"shares issuer and vault pseudo-account must be the same",
|
||||
"shares issuer must be a pseudo-account",
|
||||
"shares issuer pseudo-account must point back to the vault"},
|
||||
"shares issuer pseudo-account must point back to the vault",
|
||||
"changed an unchangeable field"},
|
||||
[&](Account const& A1, Account const& A2, ApplyContext& ac) {
|
||||
auto const keylet = keylet::vault(A1.id(), ac.view().seq());
|
||||
auto sleVault = ac.view().peek(keylet);
|
||||
@@ -3249,7 +3315,7 @@ class Invariants_test : public beast::unit_test::suite
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttVAULT_CREATE, [](STObject&) {}},
|
||||
{tecINVARIANT_FAILED, tecINVARIANT_FAILED},
|
||||
{tecINVARIANT_FAILED, tefINVARIANT_FAILED},
|
||||
[&](Account const& A1, Account const& A2, Env& env) {
|
||||
Vault const vault{env};
|
||||
auto [tx, keylet] = vault.create({.owner = A1, .asset = xrpIssue()});
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -139,7 +139,7 @@ class LedgerLoad_test : public beast::unit_test::suite
|
||||
{
|
||||
testcase("Load ledger: Bad Files");
|
||||
using namespace test::jtx;
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
// empty path
|
||||
except([&] {
|
||||
@@ -161,8 +161,8 @@ class LedgerLoad_test : public beast::unit_test::suite
|
||||
});
|
||||
|
||||
// make a corrupted version of the ledger file (last 10 bytes removed).
|
||||
std::error_code ec;
|
||||
auto ledgerFileCorrupt = std::filesystem::path{sd.dbPath} / "ledgerdata_bad.json";
|
||||
boost::system::error_code ec;
|
||||
auto ledgerFileCorrupt = boost::filesystem::path{sd.dbPath} / "ledgerdata_bad.json";
|
||||
copy_file(sd.ledgerFile, ledgerFileCorrupt, copy_options::overwrite_existing, ec);
|
||||
if (!BEAST_EXPECTS(!ec, ec.message()))
|
||||
return;
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
#include <xrpl/server/Manifest.h>
|
||||
#include <xrpl/server/Wallet.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -53,18 +55,18 @@ private:
|
||||
}
|
||||
|
||||
static void
|
||||
cleanupDatabaseDir(std::filesystem::path const& dbPath)
|
||||
cleanupDatabaseDir(boost::filesystem::path const& dbPath)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (!exists(dbPath) || !is_directory(dbPath) || !is_empty(dbPath))
|
||||
return;
|
||||
remove(dbPath);
|
||||
}
|
||||
|
||||
static void
|
||||
setupDatabaseDir(std::filesystem::path const& dbPath)
|
||||
setupDatabaseDir(boost::filesystem::path const& dbPath)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (!exists(dbPath))
|
||||
{
|
||||
create_directory(dbPath);
|
||||
@@ -77,10 +79,10 @@ private:
|
||||
Throw<std::runtime_error>("Cannot create directory: " + dbPath.string());
|
||||
}
|
||||
}
|
||||
static std::filesystem::path
|
||||
static boost::filesystem::path
|
||||
getDatabasePath()
|
||||
{
|
||||
return std::filesystem::current_path() / "manifest_test_databases";
|
||||
return boost::filesystem::current_path() / "manifest_test_databases";
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -349,7 +351,7 @@ public:
|
||||
BEAST_EXPECT(loaded.revoked(pk));
|
||||
}
|
||||
}
|
||||
std::filesystem::remove(getDatabasePath() / std::filesystem::path(dbName));
|
||||
boost::filesystem::remove(getDatabasePath() / boost::filesystem::path(dbName));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -490,7 +491,7 @@ public:
|
||||
makeBackendRotating(jtx::Env& env, NodeStoreScheduler& scheduler, std::string path)
|
||||
{
|
||||
Section section{env.app().config().section(ConfigSection::nodeDatabase())};
|
||||
std::filesystem::path newPath;
|
||||
boost::filesystem::path newPath;
|
||||
|
||||
if (!BEAST_EXPECT(path.size()))
|
||||
return {};
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
|
||||
#include <date/date.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
@@ -600,7 +601,7 @@ public:
|
||||
detail::default_effective_overlap,
|
||||
60 * 24}}); // max of 24 hours
|
||||
}
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
for (auto const& file : directory_iterator(good.subdir()))
|
||||
{
|
||||
remove_all(file);
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <xrpl/basics/FileUtilities.h>
|
||||
#include <xrpl/beast/unit_test/suite.h>
|
||||
|
||||
#include <system_error>
|
||||
#include <boost/system/detail/errc.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -15,13 +16,14 @@ public:
|
||||
testGetFileContents()
|
||||
{
|
||||
using namespace xrpl::detail;
|
||||
using namespace boost::system;
|
||||
|
||||
constexpr char const* expectedContents = "This file is very short. That's all we need.";
|
||||
|
||||
FileDirGuard const file(
|
||||
*this, "test_file", "test.txt", "This is temporary text that should get overwritten");
|
||||
|
||||
std::error_code ec;
|
||||
error_code ec;
|
||||
auto const path = file.file();
|
||||
|
||||
writeFileContents(ec, path, expectedContents);
|
||||
@@ -44,7 +46,7 @@ public:
|
||||
{
|
||||
// Test with small max
|
||||
auto const bad = getFileContents(ec, path, 16);
|
||||
BEAST_EXPECT(ec && ec == std::errc::file_too_large);
|
||||
BEAST_EXPECT(ec && ec.value() == boost::system::errc::file_too_large);
|
||||
BEAST_EXPECT(bad.empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
#include <xrpl/protocol/ErrorCodes.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/filesystem/file_status.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <iterator>
|
||||
@@ -27,7 +31,6 @@
|
||||
#include <ostream>
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -40,7 +43,7 @@ class PerfLog_test : public beast::unit_test::suite
|
||||
{
|
||||
enum class WithFile : bool { no = false, yes = true };
|
||||
|
||||
using path = std::filesystem::path;
|
||||
using path = boost::filesystem::path;
|
||||
|
||||
// We're only using Env for its Journal. That Journal gives better
|
||||
// coverage in unit tests.
|
||||
@@ -63,14 +66,14 @@ class PerfLog_test : public beast::unit_test::suite
|
||||
// The error code is intentionally ignored: if the path doesn't
|
||||
// exist (the common case on a clean runner) remove_all returns
|
||||
// an error, and that's fine — there's nothing to clean up.
|
||||
using namespace std::filesystem;
|
||||
std::error_code ec;
|
||||
using namespace boost::filesystem;
|
||||
boost::system::error_code ec;
|
||||
remove_all(logDir(), ec);
|
||||
}
|
||||
|
||||
~Fixture()
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
auto const dir{logDir()};
|
||||
auto const file{logFile()};
|
||||
@@ -93,7 +96,7 @@ class PerfLog_test : public beast::unit_test::suite
|
||||
static path
|
||||
logDir()
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
return temp_directory_path() / "perf_log_test_dir";
|
||||
}
|
||||
|
||||
@@ -126,7 +129,7 @@ class PerfLog_test : public beast::unit_test::suite
|
||||
static void
|
||||
wait()
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
auto const path = logFile();
|
||||
if (!exists(path))
|
||||
@@ -198,7 +201,7 @@ public:
|
||||
void
|
||||
testFileCreation()
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
{
|
||||
// Verify a PerfLog creates its file when constructed.
|
||||
@@ -253,23 +256,22 @@ public:
|
||||
|
||||
// Construct and write protect a file to prevent PerfLog
|
||||
// from creating its file.
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(fixture.logDir(), ec);
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::create_directories(fixture.logDir(), ec);
|
||||
if (!BEAST_EXPECT(!ec))
|
||||
return;
|
||||
|
||||
auto fileWriteable = [](std::filesystem::path const& p) -> bool {
|
||||
auto fileWriteable = [](boost::filesystem::path const& p) -> bool {
|
||||
return std::ofstream{p.c_str(), std::ios::out | std::ios::app}.is_open();
|
||||
};
|
||||
|
||||
if (!BEAST_EXPECT(fileWriteable(fixture.logFile())))
|
||||
return;
|
||||
|
||||
std::filesystem::permissions(
|
||||
boost::filesystem::permissions(
|
||||
fixture.logFile(),
|
||||
std::filesystem::perms::owner_write | std::filesystem::perms::others_write |
|
||||
std::filesystem::perms::group_write,
|
||||
std::filesystem::perm_options::remove);
|
||||
perms::remove_perms | perms::owner_write | perms::others_write |
|
||||
perms::group_write);
|
||||
|
||||
// If the test is running as root, then the write protect may have
|
||||
// no effect. Make sure write protect worked before proceeding.
|
||||
@@ -293,11 +295,9 @@ public:
|
||||
perfLog->stop();
|
||||
|
||||
// Fix file permissions so the file can be cleaned up.
|
||||
std::filesystem::permissions(
|
||||
boost::filesystem::permissions(
|
||||
fixture.logFile(),
|
||||
std::filesystem::perms::owner_write | std::filesystem::perms::others_write |
|
||||
std::filesystem::perms::group_write,
|
||||
std::filesystem::perm_options::add);
|
||||
perms::add_perms | perms::owner_write | perms::others_write | perms::group_write);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -962,7 +962,7 @@ public:
|
||||
// We can't fully test rotate because unit tests must run on Windows,
|
||||
// and Windows doesn't (may not?) support rotate. But at least call
|
||||
// the interface and see that it doesn't crash.
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
Fixture fixture{env_.app(), j_};
|
||||
BEAST_EXPECT(!exists(fixture.logDir()));
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <xrpl/protocol/SystemParameters.h> // IWYU pragma: keep
|
||||
#include <xrpl/server/Port.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/format.hpp> // IWYU pragma: keep
|
||||
#include <boost/format/free_funcs.hpp>
|
||||
#include <boost/lexical_cast/bad_lexical_cast.hpp>
|
||||
@@ -19,7 +20,6 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
[[nodiscard]] bool
|
||||
dataDirExists() const
|
||||
{
|
||||
return std::filesystem::is_directory(dataDir_);
|
||||
return boost::filesystem::is_directory(dataDir_);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
{
|
||||
try
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (rmDataDir_)
|
||||
rmDir(dataDir_);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
class Config_test final : public TestSuite
|
||||
{
|
||||
private:
|
||||
using path = std::filesystem::path;
|
||||
using path = boost::filesystem::path;
|
||||
|
||||
public:
|
||||
void
|
||||
@@ -309,7 +309,7 @@ port_wss_admin
|
||||
{
|
||||
testcase("config_file");
|
||||
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
auto const cwd = current_path();
|
||||
|
||||
// Test both config file names.
|
||||
@@ -425,7 +425,7 @@ port_wss_admin
|
||||
{
|
||||
testcase("database_path");
|
||||
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
{
|
||||
boost::format cc("[database_path]\n%1%\n");
|
||||
|
||||
@@ -601,7 +601,7 @@ main
|
||||
{
|
||||
testcase("validators_file");
|
||||
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
{
|
||||
// load should throw for missing specified validators file
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <xrpl/rdb/SociDB.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
|
||||
#include <soci/into.h>
|
||||
@@ -16,7 +18,6 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
@@ -29,7 +30,7 @@ class SociDB_test final : public TestSuite
|
||||
{
|
||||
private:
|
||||
static void
|
||||
setupSQLiteConfig(BasicConfig& config, std::filesystem::path const& dbPath)
|
||||
setupSQLiteConfig(BasicConfig& config, boost::filesystem::path const& dbPath)
|
||||
{
|
||||
config.overwrite("sqdb", "backend", "sqlite");
|
||||
auto value = dbPath.string();
|
||||
@@ -38,18 +39,18 @@ private:
|
||||
}
|
||||
|
||||
static void
|
||||
cleanupDatabaseDir(std::filesystem::path const& dbPath)
|
||||
cleanupDatabaseDir(boost::filesystem::path const& dbPath)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (!exists(dbPath) || !is_directory(dbPath) || !is_empty(dbPath))
|
||||
return;
|
||||
remove(dbPath);
|
||||
}
|
||||
|
||||
static void
|
||||
setupDatabaseDir(std::filesystem::path const& dbPath)
|
||||
setupDatabaseDir(boost::filesystem::path const& dbPath)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (!exists(dbPath))
|
||||
{
|
||||
create_directory(dbPath);
|
||||
@@ -62,10 +63,10 @@ private:
|
||||
Throw<std::runtime_error>("Cannot create directory: " + dbPath.string());
|
||||
}
|
||||
}
|
||||
static std::filesystem::path
|
||||
static boost::filesystem::path
|
||||
getDatabasePath()
|
||||
{
|
||||
return std::filesystem::current_path() / "socidb_test_databases";
|
||||
return boost::filesystem::current_path() / "socidb_test_databases";
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -155,7 +156,7 @@ public:
|
||||
checkValues(s);
|
||||
}
|
||||
{
|
||||
namespace bfs = std::filesystem;
|
||||
namespace bfs = boost::filesystem;
|
||||
// Remove the database
|
||||
bfs::path const dbPath(sc.connectionString());
|
||||
if (bfs::is_regular_file(dbPath))
|
||||
@@ -285,7 +286,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
{
|
||||
namespace bfs = std::filesystem;
|
||||
namespace bfs = boost::filesystem;
|
||||
// Remove the database
|
||||
bfs::path const dbPath(sc.connectionString());
|
||||
if (bfs::is_regular_file(dbPath))
|
||||
@@ -337,7 +338,7 @@ public:
|
||||
s << "SELECT LedgerSeq FROM Ledgers;", soci::into(ledgersLS);
|
||||
BEAST_EXPECT(ledgersLS.size() == numRows);
|
||||
}
|
||||
namespace bfs = std::filesystem;
|
||||
namespace bfs = boost::filesystem;
|
||||
// Remove the database
|
||||
bfs::path const dbPath(sc.connectionString());
|
||||
if (bfs::is_regular_file(dbPath))
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include <xrpl/basics/contract.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace xrpl::detail {
|
||||
@@ -15,7 +16,7 @@ namespace xrpl::detail {
|
||||
class DirGuard
|
||||
{
|
||||
protected:
|
||||
using path = std::filesystem::path;
|
||||
using path = boost::filesystem::path;
|
||||
|
||||
private:
|
||||
path subDir_;
|
||||
@@ -42,7 +43,7 @@ public:
|
||||
DirGuard(beast::unit_test::suite& test, path subDir, bool useCounter = true)
|
||||
: subDir_(std::move(subDir)), test_(test)
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
static auto subDirCounter = 0;
|
||||
if (useCounter)
|
||||
@@ -68,7 +69,7 @@ public:
|
||||
{
|
||||
try
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
if (rmSubDir_)
|
||||
rmDir(subDir_);
|
||||
@@ -125,7 +126,7 @@ public:
|
||||
{
|
||||
try
|
||||
{
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
if (exists(file_))
|
||||
{
|
||||
remove(file_);
|
||||
@@ -155,7 +156,7 @@ public:
|
||||
[[nodiscard]] bool
|
||||
fileExists() const
|
||||
{
|
||||
return std::filesystem::exists(file_);
|
||||
return boost::filesystem::exists(file_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -78,11 +78,9 @@
|
||||
#include <xrpl/protocol/ApiVersion.h>
|
||||
#include <xrpl/protocol/BuildInfo.h>
|
||||
#include <xrpl/protocol/Feature.h>
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
#include <xrpl/protocol/Protocol.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/Serializer.h>
|
||||
#include <xrpl/protocol/SystemParameters.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
#include <xrpl/resource/Charge.h>
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -614,7 +613,7 @@ GRPCServerImpl::createServerCredentials()
|
||||
|
||||
try
|
||||
{
|
||||
std::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
grpc::SslServerCredentialsOptions sslOpts;
|
||||
grpc::SslServerCredentialsOptions::PemKeyCertPair keyCertPair;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/Feature.h>
|
||||
#include <xrpl/protocol/Fees.h>
|
||||
#include <xrpl/protocol/Protocol.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STValidation.h>
|
||||
|
||||
@@ -24,23 +24,19 @@
|
||||
#include <xrpl/shamap/SHAMapTreeNode.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -372,11 +368,11 @@ void
|
||||
SHAMapStoreImp::dbPaths()
|
||||
{
|
||||
Section const section{app_.config().section(ConfigSection::nodeDatabase())};
|
||||
std::filesystem::path dbPath = get(section, "path");
|
||||
boost::filesystem::path dbPath = get(section, "path");
|
||||
|
||||
if (std::filesystem::exists(dbPath))
|
||||
if (boost::filesystem::exists(dbPath))
|
||||
{
|
||||
if (!std::filesystem::is_directory(dbPath))
|
||||
if (!boost::filesystem::is_directory(dbPath))
|
||||
{
|
||||
journal_.error() << "node db path must be a directory. " << dbPath.string();
|
||||
Throw<std::runtime_error>("node db path must be a directory.");
|
||||
@@ -384,7 +380,7 @@ SHAMapStoreImp::dbPaths()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::filesystem::create_directories(dbPath);
|
||||
boost::filesystem::create_directories(dbPath);
|
||||
}
|
||||
|
||||
SavedState state = state_db_.getState();
|
||||
@@ -395,8 +391,8 @@ SHAMapStoreImp::dbPaths()
|
||||
return false;
|
||||
|
||||
// Check if configured "path" matches stored directory path
|
||||
using namespace std::filesystem;
|
||||
auto const stored{std::filesystem::path(sPath)};
|
||||
using namespace boost::filesystem;
|
||||
auto const stored{path(sPath)};
|
||||
if (stored.parent_path() == dbPath)
|
||||
return false;
|
||||
|
||||
@@ -414,9 +410,9 @@ SHAMapStoreImp::dbPaths()
|
||||
bool writableDbExists = false;
|
||||
bool archiveDbExists = false;
|
||||
|
||||
std::vector<std::filesystem::path> pathsToDelete;
|
||||
for (std::filesystem::directory_iterator it(dbPath);
|
||||
it != std::filesystem::directory_iterator();
|
||||
std::vector<boost::filesystem::path> pathsToDelete;
|
||||
for (boost::filesystem::directory_iterator it(dbPath);
|
||||
it != boost::filesystem::directory_iterator();
|
||||
++it)
|
||||
{
|
||||
if (state.writableDb.compare(it->path().string()) == 0)
|
||||
@@ -437,7 +433,7 @@ SHAMapStoreImp::dbPaths()
|
||||
(!archiveDbExists && !state.archiveDb.empty()) || (writableDbExists != archiveDbExists) ||
|
||||
state.writableDb.empty() != state.archiveDb.empty())
|
||||
{
|
||||
std::filesystem::path stateDbPathName = app_.config().legacy("database_path");
|
||||
boost::filesystem::path stateDbPathName = app_.config().legacy("database_path");
|
||||
stateDbPathName /= dbName_;
|
||||
stateDbPathName += "*";
|
||||
|
||||
@@ -459,15 +455,15 @@ SHAMapStoreImp::dbPaths()
|
||||
}
|
||||
|
||||
// The necessary directories exist. Now, remove any others.
|
||||
for (std::filesystem::path const& p : pathsToDelete)
|
||||
std::filesystem::remove_all(p);
|
||||
for (boost::filesystem::path const& p : pathsToDelete)
|
||||
boost::filesystem::remove_all(p);
|
||||
}
|
||||
|
||||
std::unique_ptr<NodeStore::Backend>
|
||||
SHAMapStoreImp::makeBackendRotating(std::string path)
|
||||
{
|
||||
Section section{app_.config().section(ConfigSection::nodeDatabase())};
|
||||
std::filesystem::path newPath;
|
||||
boost::filesystem::path newPath;
|
||||
|
||||
if (!path.empty())
|
||||
{
|
||||
@@ -475,24 +471,10 @@ SHAMapStoreImp::makeBackendRotating(std::string path)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::filesystem::path const p = get(section, "path");
|
||||
std::random_device rd;
|
||||
constexpr std::size_t maxAttempts = 100;
|
||||
for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << std::hex << std::setfill('0') << std::setw(8) << rd() << std::setw(8) << rd();
|
||||
auto const candidate =
|
||||
std::filesystem::path((p / dbPrefix_).string() + "." + oss.str());
|
||||
std::error_code existsEc;
|
||||
if (!std::filesystem::exists(candidate, existsEc) && !existsEc)
|
||||
{
|
||||
newPath = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newPath.empty())
|
||||
Throw<std::runtime_error>("Unable to generate a unique rotating backend path");
|
||||
boost::filesystem::path p = get(section, "path");
|
||||
p /= dbPrefix_;
|
||||
p += ".%%%%";
|
||||
newPath = boost::filesystem::unique_path(p);
|
||||
}
|
||||
section.set("path", newPath.string());
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
@@ -205,7 +204,7 @@ class ValidatorList
|
||||
ManifestCache& validatorManifests_;
|
||||
ManifestCache& publisherManifests_;
|
||||
TimeKeeper& timeKeeper_;
|
||||
std::filesystem::path const dataPath_;
|
||||
boost::filesystem::path const dataPath_;
|
||||
beast::Journal const j_;
|
||||
std::shared_mutex mutable mutex_;
|
||||
using lock_guard = std::lock_guard<decltype(mutex_)>;
|
||||
@@ -804,7 +803,7 @@ private:
|
||||
|
||||
/** Get the filename used for caching UNLs
|
||||
*/
|
||||
std::filesystem::path
|
||||
boost::filesystem::path
|
||||
getCacheFileName(lock_guard const&, PublicKey const& pubKey) const;
|
||||
|
||||
/** Build a Json representation of the collection, suitable for
|
||||
|
||||
@@ -29,8 +29,12 @@
|
||||
#include <xrpl/server/Manifest.h>
|
||||
#include <xrpl/server/NetworkOPs.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/regex/v5/regex.hpp>
|
||||
#include <boost/regex/v5/regex_match.hpp>
|
||||
#include <boost/system/detail/errc.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
#include <boost/system/errc.hpp>
|
||||
|
||||
#include <xrpl.pb.h>
|
||||
|
||||
@@ -39,7 +43,6 @@
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
@@ -51,7 +54,6 @@
|
||||
#include <shared_mutex>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -286,7 +288,7 @@ ValidatorList::load(
|
||||
return true;
|
||||
}
|
||||
|
||||
std::filesystem::path
|
||||
boost::filesystem::path
|
||||
ValidatorList::getCacheFileName(ValidatorList::lock_guard const&, PublicKey const& pubKey) const
|
||||
{
|
||||
return dataPath_ / (filePrefix_ + strHex(pubKey));
|
||||
@@ -370,9 +372,9 @@ ValidatorList::cacheValidatorFile(ValidatorList::lock_guard const& lock, PublicK
|
||||
if (dataPath_.empty())
|
||||
return;
|
||||
|
||||
std::filesystem::path const filename = getCacheFileName(lock, pubKey);
|
||||
boost::filesystem::path const filename = getCacheFileName(lock, pubKey);
|
||||
|
||||
std::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
|
||||
Json::Value value = buildFileData(strHex(pubKey), publisherLists_.at(pubKey), j_);
|
||||
// xrpld should be the only process writing to this file, so
|
||||
@@ -1281,7 +1283,8 @@ std::vector<std::string>
|
||||
ValidatorList::loadLists()
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
using namespace std::filesystem;
|
||||
using namespace boost::filesystem;
|
||||
using namespace boost::system::errc;
|
||||
|
||||
std::lock_guard const lock{mutex_};
|
||||
|
||||
@@ -1289,12 +1292,12 @@ ValidatorList::loadLists()
|
||||
sites.reserve(publisherLists_.size());
|
||||
for (auto const& [pubKey, publisherCollection] : publisherLists_)
|
||||
{
|
||||
std::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
|
||||
if (publisherCollection.status == PublisherStatus::available)
|
||||
continue;
|
||||
|
||||
std::filesystem::path const filename = getCacheFileName(lock, pubKey);
|
||||
boost::filesystem::path const filename = getCacheFileName(lock, pubKey);
|
||||
|
||||
auto const fullPath{canonical(filename, ec)};
|
||||
if (ec)
|
||||
@@ -1305,7 +1308,7 @@ ValidatorList::loadLists()
|
||||
{
|
||||
// Treat an empty file as a missing file, because
|
||||
// nobody else is going to write it.
|
||||
ec = make_error_code(std::errc::no_such_file_or_directory);
|
||||
ec = make_error_code(no_such_file_or_directory);
|
||||
}
|
||||
if (ec)
|
||||
continue;
|
||||
|
||||
@@ -37,8 +37,10 @@
|
||||
#include <xrpl/rdb/RelationalDatabase.h>
|
||||
#include <xrpl/rdb/SociDB.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/format/free_funcs.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
#include <soci/blob.h>
|
||||
#include <soci/into.h>
|
||||
@@ -51,7 +53,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
@@ -60,7 +61,6 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
@@ -1290,8 +1290,8 @@ getTransaction(
|
||||
bool
|
||||
dbHasSpace(soci::session& session, Config const& config, beast::Journal j)
|
||||
{
|
||||
std::filesystem::space_info const space =
|
||||
std::filesystem::space(config.legacy("database_path"));
|
||||
boost::filesystem::space_info const space =
|
||||
boost::filesystem::space(config.legacy("database_path"));
|
||||
|
||||
if (space.available < megabytes(512))
|
||||
{
|
||||
@@ -1302,9 +1302,9 @@ dbHasSpace(soci::session& session, Config const& config, beast::Journal j)
|
||||
if (config.useTxTables())
|
||||
{
|
||||
DatabaseCon::Setup const dbSetup = setup_DatabaseCon(config);
|
||||
std::filesystem::path const dbPath = dbSetup.dataDir / TxDBName;
|
||||
std::error_code ec;
|
||||
std::optional<std::uint64_t> dbSize = std::filesystem::file_size(dbPath, ec);
|
||||
boost::filesystem::path const dbPath = dbSetup.dataDir / TxDBName;
|
||||
boost::system::error_code ec;
|
||||
std::optional<std::uint64_t> dbSize = boost::filesystem::file_size(dbPath, ec);
|
||||
if (ec)
|
||||
{
|
||||
JLOG(j.error()) << "Error checking transaction db file size: " << ec.message();
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#include <xrpl/protocol/SystemParameters.h> // VFALCO Breaks levelization
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
|
||||
#include <boost/filesystem.hpp> // VFALCO FIX: This include should not be here
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@@ -81,17 +82,17 @@ public:
|
||||
static char const* const validatorsFileName;
|
||||
|
||||
/** Returns the full path and filename of the debug log file. */
|
||||
[[nodiscard]] std::filesystem::path
|
||||
[[nodiscard]] boost::filesystem::path
|
||||
getDebugLogFile() const;
|
||||
|
||||
private:
|
||||
std::filesystem::path CONFIG_FILE;
|
||||
boost::filesystem::path CONFIG_FILE;
|
||||
|
||||
public:
|
||||
std::filesystem::path CONFIG_DIR;
|
||||
boost::filesystem::path CONFIG_DIR;
|
||||
|
||||
private:
|
||||
std::filesystem::path DEBUG_LOGFILE;
|
||||
boost::filesystem::path DEBUG_LOGFILE;
|
||||
|
||||
void
|
||||
load();
|
||||
|
||||
@@ -22,19 +22,21 @@
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/format/free_funcs.hpp>
|
||||
#include <boost/multiprecision/detail/endian.hpp>
|
||||
#include <boost/predef.h>
|
||||
#include <boost/regex.hpp> // IWYU pragma: keep
|
||||
#include <boost/regex/v5/regex.hpp>
|
||||
#include <boost/regex/v5/regex_match.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
@@ -44,7 +46,6 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@@ -312,13 +313,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
// directory, use the current working directory as the
|
||||
// config directory and that with "db" as the data
|
||||
// directory.
|
||||
std::filesystem::path dataDir;
|
||||
boost::filesystem::path dataDir;
|
||||
|
||||
if (!strConf.empty())
|
||||
{
|
||||
// --conf=<path> : everything is relative that file.
|
||||
CONFIG_FILE = strConf;
|
||||
CONFIG_DIR = std::filesystem::absolute(CONFIG_FILE);
|
||||
CONFIG_DIR = boost::filesystem::absolute(CONFIG_FILE);
|
||||
CONFIG_DIR.remove_filename();
|
||||
dataDir = CONFIG_DIR / databaseDirName;
|
||||
}
|
||||
@@ -329,13 +330,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
// Check if either of the config files exist in the current working
|
||||
// directory, in which case the databases will be stored in a
|
||||
// subdirectory.
|
||||
CONFIG_DIR = std::filesystem::current_path();
|
||||
CONFIG_DIR = boost::filesystem::current_path();
|
||||
dataDir = CONFIG_DIR / databaseDirName;
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (std::filesystem::exists(CONFIG_FILE))
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
if (std::filesystem::exists(CONFIG_FILE))
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
|
||||
// Check if the home directory is set, and optionally the XDG config
|
||||
@@ -362,10 +363,10 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
dataDir = strXdgDataHome + "/" + systemName();
|
||||
CONFIG_DIR = strXdgConfigHome + "/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (std::filesystem::exists(CONFIG_FILE))
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
if (std::filesystem::exists(CONFIG_FILE))
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -373,7 +374,7 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
dataDir = "/var/opt/" + systemName();
|
||||
CONFIG_DIR = "/etc/opt/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (std::filesystem::exists(CONFIG_FILE))
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
} while (false);
|
||||
@@ -386,7 +387,7 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
std::string const dbPath(legacy("database_path"));
|
||||
if (!dbPath.empty())
|
||||
{
|
||||
dataDir = std::filesystem::path(dbPath);
|
||||
dataDir = boost::filesystem::path(dbPath);
|
||||
}
|
||||
else if (RUN_STANDALONE)
|
||||
{
|
||||
@@ -396,13 +397,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand
|
||||
|
||||
if (!dataDir.empty())
|
||||
{
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(dataDir, ec);
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::create_directories(dataDir, ec);
|
||||
|
||||
if (ec)
|
||||
Throw<std::runtime_error>(boost::str(boost::format("Can not create %s") % dataDir));
|
||||
|
||||
legacy("database_path", std::filesystem::absolute(dataDir).string());
|
||||
legacy("database_path", boost::filesystem::absolute(dataDir).string());
|
||||
}
|
||||
|
||||
HTTPClient::initializeSSLContext(
|
||||
@@ -455,7 +456,7 @@ Config::load()
|
||||
if (!QUIET)
|
||||
std::cerr << "Loading: " << CONFIG_FILE << "\n";
|
||||
|
||||
std::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
auto const fileContents = getFileContents(ec, CONFIG_FILE);
|
||||
|
||||
if (ec)
|
||||
@@ -508,8 +509,8 @@ Config::loadFromString(std::string const& fileContents)
|
||||
std::string dbPath;
|
||||
if (getSingleSection(secConfig, "database_path", dbPath, j_))
|
||||
{
|
||||
std::filesystem::path const p(dbPath);
|
||||
legacy("database_path", std::filesystem::absolute(p).string());
|
||||
boost::filesystem::path const p(dbPath);
|
||||
legacy("database_path", boost::filesystem::absolute(p).string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -952,7 +953,7 @@ Config::loadFromString(std::string const& fileContents)
|
||||
// If no path was specified, then look for validators.txt
|
||||
// in the same directory as the config file, but don't complain
|
||||
// if we can't find it.
|
||||
std::filesystem::path validatorsFile;
|
||||
boost::filesystem::path validatorsFile;
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_VALIDATORS_FILE, strTemp, j_))
|
||||
{
|
||||
@@ -967,7 +968,7 @@ Config::loadFromString(std::string const& fileContents)
|
||||
if (!validatorsFile.is_absolute() && !CONFIG_DIR.empty())
|
||||
validatorsFile = CONFIG_DIR / validatorsFile;
|
||||
|
||||
if (!std::filesystem::exists(validatorsFile))
|
||||
if (!boost::filesystem::exists(validatorsFile))
|
||||
{
|
||||
Throw<std::runtime_error>(
|
||||
"The file specified in [" SECTION_VALIDATORS_FILE
|
||||
@@ -976,8 +977,8 @@ Config::loadFromString(std::string const& fileContents)
|
||||
validatorsFile.string());
|
||||
}
|
||||
else if (
|
||||
!std::filesystem::is_regular_file(validatorsFile) &&
|
||||
!std::filesystem::is_symlink(validatorsFile))
|
||||
!boost::filesystem::is_regular_file(validatorsFile) &&
|
||||
!boost::filesystem::is_symlink(validatorsFile))
|
||||
{
|
||||
Throw<std::runtime_error>(
|
||||
"Invalid file specified in [" SECTION_VALIDATORS_FILE "]: " +
|
||||
@@ -990,24 +991,24 @@ Config::loadFromString(std::string const& fileContents)
|
||||
|
||||
if (!validatorsFile.empty())
|
||||
{
|
||||
if (!std::filesystem::exists(validatorsFile))
|
||||
if (!boost::filesystem::exists(validatorsFile))
|
||||
{
|
||||
validatorsFile.clear();
|
||||
}
|
||||
else if (
|
||||
!std::filesystem::is_regular_file(validatorsFile) &&
|
||||
!std::filesystem::is_symlink(validatorsFile))
|
||||
!boost::filesystem::is_regular_file(validatorsFile) &&
|
||||
!boost::filesystem::is_symlink(validatorsFile))
|
||||
{
|
||||
validatorsFile.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!validatorsFile.empty() && std::filesystem::exists(validatorsFile) &&
|
||||
(std::filesystem::is_regular_file(validatorsFile) ||
|
||||
std::filesystem::is_symlink(validatorsFile)))
|
||||
if (!validatorsFile.empty() && boost::filesystem::exists(validatorsFile) &&
|
||||
(boost::filesystem::is_regular_file(validatorsFile) ||
|
||||
boost::filesystem::is_symlink(validatorsFile)))
|
||||
{
|
||||
std::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
auto const data = getFileContents(ec, validatorsFile);
|
||||
if (ec)
|
||||
{
|
||||
@@ -1133,7 +1134,7 @@ Config::loadFromString(std::string const& fileContents)
|
||||
}
|
||||
}
|
||||
|
||||
std::filesystem::path
|
||||
boost::filesystem::path
|
||||
Config::getDebugLogFile() const
|
||||
{
|
||||
auto log_file = DEBUG_LOGFILE;
|
||||
@@ -1142,17 +1143,17 @@ Config::getDebugLogFile() const
|
||||
{
|
||||
// Unless an absolute path for the log file is specified, the
|
||||
// path is relative to the config file directory.
|
||||
log_file = CONFIG_DIR / log_file;
|
||||
log_file = boost::filesystem::absolute(log_file, CONFIG_DIR);
|
||||
}
|
||||
|
||||
if (!log_file.empty())
|
||||
{
|
||||
auto log_dir = log_file.parent_path();
|
||||
|
||||
if (!std::filesystem::is_directory(log_dir))
|
||||
if (!boost::filesystem::is_directory(log_dir))
|
||||
{
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(log_dir, ec);
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::create_directories(log_dir, ec);
|
||||
|
||||
// If we fail, we warn but continue so that the calling code can
|
||||
// decide how to handle this situation.
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
#include <xrpl/json/json_writer.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
@@ -23,7 +25,6 @@
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -215,10 +216,10 @@ PerfLogImp::openLog()
|
||||
logFile_.close();
|
||||
|
||||
auto logDir = setup_.perfLog.parent_path();
|
||||
if (!std::filesystem::is_directory(logDir))
|
||||
if (!boost::filesystem::is_directory(logDir))
|
||||
{
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(logDir, ec);
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::create_directories(logDir, ec);
|
||||
if (ec)
|
||||
{
|
||||
JLOG(j_.fatal()) << "Unable to create performance log "
|
||||
@@ -473,17 +474,17 @@ PerfLogImp::stop()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PerfLog::Setup
|
||||
setup_PerfLog(Section const& section, std::filesystem::path const& configDir)
|
||||
setup_PerfLog(Section const& section, boost::filesystem::path const& configDir)
|
||||
{
|
||||
PerfLog::Setup setup;
|
||||
std::string perfLog;
|
||||
set(perfLog, "perf_log", section);
|
||||
if (!perfLog.empty())
|
||||
{
|
||||
setup.perfLog = std::filesystem::path(perfLog);
|
||||
setup.perfLog = boost::filesystem::path(perfLog);
|
||||
if (setup.perfLog.is_relative())
|
||||
{
|
||||
setup.perfLog = configDir / setup.perfLog;
|
||||
setup.perfLog = boost::filesystem::absolute(setup.perfLog, configDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user