mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Store STTx in JTx
Conflicts: src/ripple/test/jtx/impl/Env.cpp
This commit is contained in:
committed by
Nik Bougalis
parent
c7dea3ed17
commit
13b33b5d4d
@@ -286,6 +286,7 @@ public:
|
||||
JTx jt(std::forward<JsonValue>(jv));
|
||||
invoke(jt, fN...);
|
||||
autofill(jt);
|
||||
jt.stx = st(jt);
|
||||
return jt;
|
||||
}
|
||||
|
||||
@@ -460,8 +461,7 @@ protected:
|
||||
Throws:
|
||||
parse_error
|
||||
*/
|
||||
// VFALCO NOTE This should be <STTx const>
|
||||
std::shared_ptr<STTx>
|
||||
std::shared_ptr<STTx const>
|
||||
st (JTx const& jt);
|
||||
|
||||
ApplyFlags
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/test/jtx/requires.h>
|
||||
#include <ripple/test/jtx/basic_prop.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -40,38 +41,41 @@ class Env;
|
||||
struct JTx
|
||||
{
|
||||
Json::Value jv;
|
||||
requires_t requires;
|
||||
TER ter = tesSUCCESS;
|
||||
bool fill_fee = true;
|
||||
bool fill_seq = true;
|
||||
bool fill_sig = true;
|
||||
std::shared_ptr<STTx const> stx;
|
||||
std::function<void(Env&, JTx&)> signer;
|
||||
requires_t requires;
|
||||
TER ter = tesSUCCESS;
|
||||
|
||||
JTx() = default;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
JTx(JTx&& src)
|
||||
: jv(std::move(src.jv))
|
||||
, fill_fee(std::move(src.fill_fee))
|
||||
, fill_seq(std::move(src.fill_seq))
|
||||
, fill_sig(std::move(src.fill_sig))
|
||||
, signer(std::move(src.signer))
|
||||
, requires(std::move(src.requires))
|
||||
, ter(std::move(src.ter))
|
||||
, props_(std::move(src.props_))
|
||||
JTx(JTx&& other)
|
||||
: jv(std::move(other.jv))
|
||||
, requires(std::move(other.requires))
|
||||
, ter(std::move(other.ter))
|
||||
, fill_fee(std::move(other.fill_fee))
|
||||
, fill_seq(std::move(other.fill_seq))
|
||||
, fill_sig(std::move(other.fill_sig))
|
||||
, stx(std::move(other.stx))
|
||||
, signer(std::move(other.signer))
|
||||
, props_(std::move(other.props_))
|
||||
{
|
||||
}
|
||||
|
||||
JTx& operator=(JTx&& src) noexcept
|
||||
JTx& operator=(JTx&& other) noexcept
|
||||
{
|
||||
jv = std::move(src.jv);
|
||||
fill_fee = std::move(src.fill_fee);
|
||||
fill_seq = std::move(src.fill_seq);
|
||||
fill_sig = std::move(src.fill_sig);
|
||||
signer = std::move(src.signer);
|
||||
requires = std::move(src.requires);
|
||||
ter = std::move(src.ter);
|
||||
props_ = std::move(src.props_);
|
||||
jv = std::move(other.jv);
|
||||
requires = std::move(other.requires);
|
||||
ter = std::move(other.ter);
|
||||
fill_fee = std::move(other.fill_fee);
|
||||
fill_seq = std::move(other.fill_seq);
|
||||
fill_sig = std::move(other.fill_sig);
|
||||
stx = std::move(other.stx);
|
||||
signer = std::move(other.signer);
|
||||
props_ = std::move(other.props_);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -94,7 +98,6 @@ struct JTx
|
||||
return jv[key];
|
||||
}
|
||||
|
||||
public:
|
||||
/** Return a property if it exists
|
||||
|
||||
@return nullptr if the Prop does not exist
|
||||
@@ -164,38 +167,38 @@ private:
|
||||
{
|
||||
prop_list() = default;
|
||||
|
||||
prop_list(prop_list const& src)
|
||||
prop_list(prop_list const& other)
|
||||
{
|
||||
for (auto const& prop : src.list)
|
||||
for (auto const& prop : other.list)
|
||||
list.emplace_back(prop->clone());
|
||||
}
|
||||
|
||||
prop_list& operator=(prop_list const& src)
|
||||
prop_list& operator=(prop_list const& other)
|
||||
{
|
||||
if (this != &src)
|
||||
if (this != &other)
|
||||
{
|
||||
list.clear();
|
||||
for (auto const& prop : src.list)
|
||||
for (auto const& prop : other.list)
|
||||
list.emplace_back(prop->clone());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
prop_list(prop_list&& src)
|
||||
: list(std::move(src.list))
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
prop_list(prop_list&& other)
|
||||
: list(std::move(other.list))
|
||||
{
|
||||
}
|
||||
|
||||
prop_list& operator=(prop_list&& src)
|
||||
prop_list& operator=(prop_list&& other)
|
||||
{
|
||||
list = std::move(src.list);
|
||||
list = std::move(other.list);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
prop_list(prop_list&& src) = default;
|
||||
prop_list& operator=(prop_list&& src) = default;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
std::vector<std::unique_ptr<
|
||||
basic_prop>> list;
|
||||
|
||||
@@ -253,9 +253,9 @@ Env::trust (STAmount const& amount,
|
||||
void
|
||||
Env::submit (JTx const& jt)
|
||||
{
|
||||
auto stx = st(jt);
|
||||
TER ter;
|
||||
bool didApply;
|
||||
auto const& stx = jt.stx;
|
||||
if (stx)
|
||||
{
|
||||
openLedger.modify(
|
||||
@@ -270,8 +270,8 @@ Env::submit (JTx const& jt)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert the exception into a TER so that
|
||||
// callers can expect it using ter(temMALFORMED)
|
||||
// Parsing failed or the JTx is
|
||||
// otherwise missing the stx field.
|
||||
ter = temMALFORMED;
|
||||
didApply = false;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ Env::autofill (JTx& jt)
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<STTx>
|
||||
std::shared_ptr<STTx const>
|
||||
Env::st (JTx const& jt)
|
||||
{
|
||||
// The parse must succeed, since we
|
||||
|
||||
Reference in New Issue
Block a user