mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 18:55:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
833df20fce |
@@ -1142,8 +1142,12 @@ NetworkOPsImp::submitTransaction(std::shared_ptr<STTx const> const& iTrans)
|
|||||||
// Enforce Network bar for emitted txn
|
// Enforce Network bar for emitted txn
|
||||||
if (view->rules().enabled(featureHooks) && hook::isEmittedTxn(*iTrans))
|
if (view->rules().enabled(featureHooks) && hook::isEmittedTxn(*iTrans))
|
||||||
{
|
{
|
||||||
JLOG(m_journal.warn())
|
// RH NOTE: Warning removed here due to ConsesusSet using this function
|
||||||
<< "Submitted transaction invalid: EmitDetails present.";
|
// which continually triggers this bar. Doesn't seem dangerous, just
|
||||||
|
// annoying.
|
||||||
|
|
||||||
|
// JLOG(m_journal.warn())
|
||||||
|
// << "Submitted transaction invalid: EmitDetails present.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1155,7 +1159,11 @@ NetworkOPsImp::submitTransaction(std::shared_ptr<STTx const> const& iTrans)
|
|||||||
|
|
||||||
if ((flags & SF_BAD) != 0)
|
if ((flags & SF_BAD) != 0)
|
||||||
{
|
{
|
||||||
JLOG(m_journal.warn()) << "Submitted transaction cached bad";
|
// RH NOTE: Warning removed here due to ConsesusSet using this function
|
||||||
|
// which continually triggers this bar. Doesn't seem dangerous, just
|
||||||
|
// annoying.
|
||||||
|
|
||||||
|
// JLOG(m_journal.warn()) << "Submitted transaction cached bad";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,11 @@ updateLedgerDBs(
|
|||||||
|
|
||||||
auto const sParentHash{to_string(ledger->info().parentHash)};
|
auto const sParentHash{to_string(ledger->info().parentHash)};
|
||||||
auto const sDrops{to_string(ledger->info().drops)};
|
auto const sDrops{to_string(ledger->info().drops)};
|
||||||
|
auto const closingTime{
|
||||||
|
ledger->info().closeTime.time_since_epoch().count()};
|
||||||
|
auto const prevClosingTime{
|
||||||
|
ledger->info().parentCloseTime.time_since_epoch().count()};
|
||||||
|
auto const closeTimeRes{ledger->info().closeTimeResolution.count()};
|
||||||
auto const sAccountHash{to_string(ledger->info().accountHash)};
|
auto const sAccountHash{to_string(ledger->info().accountHash)};
|
||||||
auto const sTxHash{to_string(ledger->info().txHash)};
|
auto const sTxHash{to_string(ledger->info().txHash)};
|
||||||
|
|
||||||
@@ -188,11 +193,8 @@ updateLedgerDBs(
|
|||||||
":closingTime, :prevClosingTime, :closeTimeRes,"
|
":closingTime, :prevClosingTime, :closeTimeRes,"
|
||||||
":closeFlags, :accountSetHash, :transSetHash);",
|
":closeFlags, :accountSetHash, :transSetHash);",
|
||||||
soci::use(sHash), soci::use(ledgerSeq), soci::use(sParentHash),
|
soci::use(sHash), soci::use(ledgerSeq), soci::use(sParentHash),
|
||||||
soci::use(sDrops),
|
soci::use(sDrops), soci::use(closingTime),
|
||||||
soci::use(ledger->info().closeTime.time_since_epoch().count()),
|
soci::use(prevClosingTime), soci::use(closeTimeRes),
|
||||||
soci::use(
|
|
||||||
ledger->info().parentCloseTime.time_since_epoch().count()),
|
|
||||||
soci::use(ledger->info().closeTimeResolution.count()),
|
|
||||||
soci::use(ledger->info().closeFlags), soci::use(sAccountHash),
|
soci::use(ledger->info().closeFlags), soci::use(sAccountHash),
|
||||||
soci::use(sTxHash);
|
soci::use(sTxHash);
|
||||||
|
|
||||||
|
|||||||
@@ -205,19 +205,20 @@ insertPeerReservation(
|
|||||||
PublicKey const& nodeId,
|
PublicKey const& nodeId,
|
||||||
std::string const& description)
|
std::string const& description)
|
||||||
{
|
{
|
||||||
|
auto const sNodeId = toBase58(TokenType::NodePublic, nodeId);
|
||||||
session << "INSERT INTO PeerReservations (PublicKey, Description) "
|
session << "INSERT INTO PeerReservations (PublicKey, Description) "
|
||||||
"VALUES (:nodeId, :desc) "
|
"VALUES (:nodeId, :desc) "
|
||||||
"ON CONFLICT (PublicKey) DO UPDATE SET "
|
"ON CONFLICT (PublicKey) DO UPDATE SET "
|
||||||
"Description=excluded.Description",
|
"Description=excluded.Description",
|
||||||
soci::use(toBase58(TokenType::NodePublic, nodeId)),
|
soci::use(sNodeId), soci::use(description);
|
||||||
soci::use(description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
deletePeerReservation(soci::session& session, PublicKey const& nodeId)
|
deletePeerReservation(soci::session& session, PublicKey const& nodeId)
|
||||||
{
|
{
|
||||||
|
auto const sNodeId = toBase58(TokenType::NodePublic, nodeId);
|
||||||
session << "DELETE FROM PeerReservations WHERE PublicKey = :nodeId",
|
session << "DELETE FROM PeerReservations WHERE PublicKey = :nodeId",
|
||||||
soci::use(toBase58(TokenType::NodePublic, nodeId));
|
soci::use(sNodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -1921,6 +1921,12 @@ Transactor::operator()()
|
|||||||
STObject const meta = metaRaw.getAsObject();
|
STObject const meta = metaRaw.getAsObject();
|
||||||
|
|
||||||
uint32_t lgrCur = view().seq();
|
uint32_t lgrCur = view().seq();
|
||||||
|
|
||||||
|
bool const has240819 = view().rules().enabled(fix240819);
|
||||||
|
|
||||||
|
auto const& sfRewardFields =
|
||||||
|
*(ripple::SField::knownCodeToField.at(917511 - has240819));
|
||||||
|
|
||||||
// iterate all affected balances
|
// iterate all affected balances
|
||||||
for (auto const& node : meta.getFieldArray(sfAffectedNodes))
|
for (auto const& node : meta.getFieldArray(sfAffectedNodes))
|
||||||
{
|
{
|
||||||
@@ -1932,7 +1938,7 @@ Transactor::operator()()
|
|||||||
if (nodeType != ltACCOUNT_ROOT || metaType == sfDeletedNode)
|
if (nodeType != ltACCOUNT_ROOT || metaType == sfDeletedNode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!node.isFieldPresent(sfFinalFields) ||
|
if (!node.isFieldPresent(sfRewardFields) ||
|
||||||
!node.isFieldPresent(sfLedgerIndex))
|
!node.isFieldPresent(sfLedgerIndex))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1948,7 +1954,7 @@ Transactor::operator()()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
STObject& finalFields = (const_cast<STObject&>(node))
|
STObject& finalFields = (const_cast<STObject&>(node))
|
||||||
.getField(sfFinalFields)
|
.getField(sfRewardFields)
|
||||||
.downcast<STObject>();
|
.downcast<STObject>();
|
||||||
|
|
||||||
if (!finalFields.isFieldPresent(sfBalance))
|
if (!finalFields.isFieldPresent(sfBalance))
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace detail {
|
|||||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||||
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
|
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
|
||||||
// the actual number of amendments. A LogicError on startup will verify this.
|
// the actual number of amendments. A LogicError on startup will verify this.
|
||||||
static constexpr std::size_t numFeatures = 70;
|
static constexpr std::size_t numFeatures = 71;
|
||||||
|
|
||||||
/** Amendments that this server supports and the default voting behavior.
|
/** Amendments that this server supports and the default voting behavior.
|
||||||
Whether they are enabled depends on the Rules defined in the validated
|
Whether they are enabled depends on the Rules defined in the validated
|
||||||
@@ -358,6 +358,7 @@ extern uint256 const fixXahauV2;
|
|||||||
extern uint256 const featureRemit;
|
extern uint256 const featureRemit;
|
||||||
extern uint256 const featureZeroB2M;
|
extern uint256 const featureZeroB2M;
|
||||||
extern uint256 const fixNSDelete;
|
extern uint256 const fixNSDelete;
|
||||||
|
extern uint256 const fix240819;
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
|
|||||||
@@ -464,6 +464,7 @@ REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::De
|
|||||||
REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo);
|
REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo);
|
||||||
REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo);
|
REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo);
|
||||||
REGISTER_FIX (fixNSDelete, Supported::yes, VoteBehavior::DefaultNo);
|
REGISTER_FIX (fixNSDelete, Supported::yes, VoteBehavior::DefaultNo);
|
||||||
|
REGISTER_FIX (fix240819, Supported::yes, VoteBehavior::DefaultYes);
|
||||||
|
|
||||||
// The following amendments are obsolete, but must remain supported
|
// The following amendments are obsolete, but must remain supported
|
||||||
// because they could potentially get enabled.
|
// because they could potentially get enabled.
|
||||||
|
|||||||
@@ -256,6 +256,8 @@ BaseWSPeer<Handler, Impl>::close(
|
|||||||
return post(strand_, [self = impl().shared_from_this(), reason] {
|
return post(strand_, [self = impl().shared_from_this(), reason] {
|
||||||
self->close(reason);
|
self->close(reason);
|
||||||
});
|
});
|
||||||
|
if (do_close_)
|
||||||
|
return;
|
||||||
do_close_ = true;
|
do_close_ = true;
|
||||||
if (wq_.empty())
|
if (wq_.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3968,8 +3968,8 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
testcase("test claim reward valid without unl report");
|
testcase("test claim reward valid without unl report");
|
||||||
|
|
||||||
Env env{
|
Env env{*this, envconfig(), features - featureXahauGenesis};
|
||||||
*this, envconfig(), supported_amendments() - featureXahauGenesis};
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
|
|
||||||
double const rateDrops = 0.00333333333 * 1'000'000;
|
double const rateDrops = 0.00333333333 * 1'000'000;
|
||||||
STAmount const feesXRP = XRP(1);
|
STAmount const feesXRP = XRP(1);
|
||||||
@@ -4050,7 +4050,12 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
|
|
||||||
env(claimReward(user, env.master), fee(feesXRP), ter(tecHOOK_REJECTED));
|
env(claimReward(user, env.master), fee(feesXRP), ter(tecHOOK_REJECTED));
|
||||||
env.close();
|
env.close();
|
||||||
@@ -4095,7 +4100,12 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser1 = preUser1 + netReward1;
|
STAmount const postUser1 = preUser1 + netReward1;
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger1, preLedger1 + 1, postUser1, preTime1));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger1,
|
||||||
|
preLedger1 + 1,
|
||||||
|
has240819 ? (preUser1 - feesXRP) : postUser1,
|
||||||
|
preTime1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4219,8 +4229,14 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4352,10 +4368,15 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postAlice = preAlice + netReward + l1Reward;
|
STAmount const postAlice = preAlice + netReward + l1Reward;
|
||||||
bool const boolResult = withXahauV1 ? true : false;
|
bool const boolResult = withXahauV1 ? true : false;
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
expectAccountFields(
|
expectAccountFields(
|
||||||
env, alice, preLedger, preLedger + 1, postAlice, preTime) ==
|
env,
|
||||||
boolResult);
|
alice,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preAlice - feesXRP) : postAlice,
|
||||||
|
preTime) == boolResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4367,6 +4388,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
testcase("test claim reward optin optout");
|
testcase("test claim reward optin optout");
|
||||||
|
|
||||||
Env env{*this, envconfig(), features - featureXahauGenesis};
|
Env env{*this, envconfig(), features - featureXahauGenesis};
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
|
|
||||||
double const rateDrops = 0.00333333333 * 1'000'000;
|
double const rateDrops = 0.00333333333 * 1'000'000;
|
||||||
STAmount const feesXRP = XRP(1);
|
STAmount const feesXRP = XRP(1);
|
||||||
@@ -4436,7 +4458,12 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
|
|
||||||
// opt out of claim rewards
|
// opt out of claim rewards
|
||||||
env(claimReward(user, std::nullopt, 1), fee(feesXRP), ter(tesSUCCESS));
|
env(claimReward(user, std::nullopt, 1), fee(feesXRP), ter(tesSUCCESS));
|
||||||
@@ -4461,7 +4488,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
user,
|
user,
|
||||||
preLedger1,
|
preLedger1,
|
||||||
preLedger1 + 1,
|
preLedger1 + 1,
|
||||||
env.balance(user),
|
has240819 ? (env.balance(user) + feesXRP) : env.balance(user),
|
||||||
preTime1));
|
preTime1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4543,8 +4570,14 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
has240819 ? preLedger : preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4618,8 +4651,14 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4824,13 +4863,13 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
Env env{
|
Env env{
|
||||||
*this,
|
*this,
|
||||||
makeGenesisConfig(
|
makeGenesisConfig(
|
||||||
supported_amendments() - featureXahauGenesis,
|
features - featureXahauGenesis,
|
||||||
21337,
|
21337,
|
||||||
"10",
|
"10",
|
||||||
"1000000",
|
"1000000",
|
||||||
"200000",
|
"200000",
|
||||||
0),
|
0),
|
||||||
supported_amendments() - featureXahauGenesis};
|
features - featureXahauGenesis};
|
||||||
|
|
||||||
STAmount const feesXRP = XRP(1);
|
STAmount const feesXRP = XRP(1);
|
||||||
|
|
||||||
@@ -4890,8 +4929,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
testcase("test compound interest over 12 claims");
|
testcase("test compound interest over 12 claims");
|
||||||
|
|
||||||
Env env{
|
Env env{*this, envconfig(), features - featureXahauGenesis};
|
||||||
*this, envconfig(), supported_amendments() - featureXahauGenesis};
|
|
||||||
|
|
||||||
double const rateDrops = 0.00333333333 * 1'000'000;
|
double const rateDrops = 0.00333333333 * 1'000'000;
|
||||||
STAmount const feesXRP = XRP(1);
|
STAmount const feesXRP = XRP(1);
|
||||||
@@ -4965,8 +5003,14 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
// validate account fields
|
// validate account fields
|
||||||
STAmount const postUser = preUser + netReward;
|
STAmount const postUser = preUser + netReward;
|
||||||
|
bool const has240819 = env.current()->rules().enabled(fix240819);
|
||||||
BEAST_EXPECT(expectAccountFields(
|
BEAST_EXPECT(expectAccountFields(
|
||||||
env, user, preLedger, preLedger + 1, postUser, preTime));
|
env,
|
||||||
|
user,
|
||||||
|
preLedger,
|
||||||
|
preLedger + 1,
|
||||||
|
has240819 ? (preUser - feesXRP) : postUser,
|
||||||
|
preTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
STAmount const endBal = env.balance(user);
|
STAmount const endBal = env.balance(user);
|
||||||
@@ -5012,6 +5056,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
auto const sa = supported_amendments();
|
auto const sa = supported_amendments();
|
||||||
testGovernHookWithFeats(sa);
|
testGovernHookWithFeats(sa);
|
||||||
|
testRewardHookWithFeats(sa - fix240819);
|
||||||
testRewardHookWithFeats(sa);
|
testRewardHookWithFeats(sa);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user