mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove STAmountSO::soTime and soTime2:
STAmount::soTime and soTime2 were time based "amendment like" switches to control small changes in behavior for STAmount. soTime2, which was the most recent, was dated Feb 27, 2016. That's over 3 years ago. The main reason to retain these soTimes would be to replay old transactions. The likelihood of needing to replay a transaction from over three years ago is pretty low. So it makes sense to remove these soTime values. In Flow_test the testZeroOutputStep() test is removed. That test started to fail when the STAmount::soTimes were removed. I checked with the original author of the test. He said that the code being tested by that unit test has been removed, so it makes sense to remove the test. That test is removed.
This commit is contained in:
committed by
Manoj doshi
parent
f7fffee28d
commit
fc0a082700
@@ -278,9 +278,6 @@ TxQ::MaybeTx::MaybeTx(
|
||||
std::pair<TER, bool>
|
||||
TxQ::MaybeTx::apply(Application& app, OpenView& view, beast::Journal j)
|
||||
{
|
||||
boost::optional<STAmountSO> saved;
|
||||
if (view.rules().enabled(fix1513))
|
||||
saved.emplace(view.info().parentCloseTime);
|
||||
// If the rules or flags change, preflight again
|
||||
assert(pfresult);
|
||||
if (pfresult->rules != view.rules() ||
|
||||
@@ -539,13 +536,7 @@ TxQ::tryClearAccountQueue(Application& app, OpenView& view,
|
||||
}
|
||||
// Apply the current tx. Because the state of the view has been changed
|
||||
// by the queued txs, we also need to preclaim again.
|
||||
auto txResult = [&]{
|
||||
boost::optional<STAmountSO> saved;
|
||||
if (view.rules().enabled(fix1513))
|
||||
saved.emplace(view.info().parentCloseTime);
|
||||
auto const pcresult = preclaim(pfresult, app, view);
|
||||
return doApply(pcresult, app, view);
|
||||
}();
|
||||
auto const txResult = doApply (preclaim (pfresult, app, view), app, view);
|
||||
|
||||
if (txResult.second)
|
||||
{
|
||||
@@ -630,11 +621,6 @@ TxQ::apply(Application& app, OpenView& view,
|
||||
auto const account = (*tx)[sfAccount];
|
||||
auto const transactionID = tx->getTransactionID();
|
||||
auto const tSeq = tx->getSequence();
|
||||
|
||||
boost::optional<STAmountSO> saved;
|
||||
if (view.rules().enabled(fix1513))
|
||||
saved.emplace(view.info().parentCloseTime);
|
||||
|
||||
// See if the transaction is valid, properly formed,
|
||||
// etc. before doing potentially expensive queue
|
||||
// replace and multi-transaction operations.
|
||||
|
||||
@@ -185,14 +185,6 @@ TER PathCursor::deliverNodeReverseImpl (
|
||||
// Compute portion of input needed to cover actual output.
|
||||
auto outputFee = mulRound (
|
||||
saOutPassAct, node().saOfrRate, node().saTakerPays.issue (), true);
|
||||
if (*stAmountCalcSwitchover == false && ! outputFee)
|
||||
{
|
||||
JLOG (j_.fatal())
|
||||
<< "underflow computing outputFee "
|
||||
<< "saOutPassAct: " << saOutPassAct
|
||||
<< " saOfrRate: " << node ().saOfrRate;
|
||||
return telFAILED_PROCESSING;
|
||||
}
|
||||
STAmount saInPassReq = std::min (node().saTakerPays, outputFee);
|
||||
STAmount saInPassAct;
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ apply (Application& app, OpenView& view,
|
||||
STTx const& tx, ApplyFlags flags,
|
||||
beast::Journal j)
|
||||
{
|
||||
STAmountSO saved(view.info().parentCloseTime);
|
||||
auto pfresult = preflight(app, view.rules(), tx, flags, j);
|
||||
auto pcresult = preclaim(pfresult, app, view);
|
||||
return doApply(pcresult, app, view);
|
||||
|
||||
@@ -20,15 +20,12 @@
|
||||
#ifndef RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/basics/IOUAmount.h>
|
||||
#include <ripple/basics/LocalValue.h>
|
||||
#include <ripple/basics/XRPAmount.h>
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/protocol/Issue.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -406,38 +403,6 @@ inline bool isXRP(STAmount const& amount)
|
||||
return isXRP (amount.issue().currency);
|
||||
}
|
||||
|
||||
extern LocalValue<bool> stAmountCalcSwitchover;
|
||||
extern LocalValue<bool> stAmountCalcSwitchover2;
|
||||
|
||||
/** RAII class to set and restore the STAmount calc switchover.*/
|
||||
class STAmountSO
|
||||
{
|
||||
public:
|
||||
explicit STAmountSO(NetClock::time_point const closeTime)
|
||||
: saved_(*stAmountCalcSwitchover)
|
||||
, saved2_(*stAmountCalcSwitchover2)
|
||||
{
|
||||
*stAmountCalcSwitchover = closeTime > soTime;
|
||||
*stAmountCalcSwitchover2 = closeTime > soTime2;
|
||||
}
|
||||
|
||||
~STAmountSO()
|
||||
{
|
||||
*stAmountCalcSwitchover = saved_;
|
||||
*stAmountCalcSwitchover2 = saved2_;
|
||||
}
|
||||
|
||||
// Mon Dec 28, 2015 18:00:00 UTC
|
||||
static NetClock::time_point const soTime;
|
||||
|
||||
// Sat Feb 27, 2016 05:00:00 UTC
|
||||
static NetClock::time_point const soTime2;
|
||||
|
||||
private:
|
||||
bool saved_;
|
||||
bool saved2_;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,17 +35,6 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
LocalValue<bool> stAmountCalcSwitchover(true);
|
||||
LocalValue<bool> stAmountCalcSwitchover2(true);
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
// Mon Dec 28, 2015 18:00:00 UTC
|
||||
const NetClock::time_point STAmountSO::soTime{504640800s};
|
||||
|
||||
// Sat Feb 27, 2016 05:00:00 UTC
|
||||
const NetClock::time_point STAmountSO::soTime2{509864400s};
|
||||
|
||||
static const std::uint64_t tenTo14 = 100000000000000ull;
|
||||
static const std::uint64_t tenTo14m1 = tenTo14 - 1;
|
||||
static const std::uint64_t tenTo17 = tenTo14 * 1000;
|
||||
@@ -1246,10 +1235,9 @@ mulRound (STAmount const& v1, STAmount const& v2, Issue const& issue,
|
||||
canonicalizeRound (xrp, amount, offset);
|
||||
STAmount result (issue, amount, offset, resultNegative);
|
||||
|
||||
// Control when bugfixes that require switchover dates are enabled
|
||||
if (roundUp && !resultNegative && !result && *stAmountCalcSwitchover)
|
||||
if (roundUp && !resultNegative && !result)
|
||||
{
|
||||
if (xrp && *stAmountCalcSwitchover2)
|
||||
if (xrp)
|
||||
{
|
||||
// return the smallest value above zero
|
||||
amount = 1;
|
||||
@@ -1318,10 +1306,9 @@ divRound (STAmount const& num, STAmount const& den,
|
||||
canonicalizeRound (isXRP (issue), amount, offset);
|
||||
|
||||
STAmount result (issue, amount, offset, resultNegative);
|
||||
// Control when bugfixes that require switchover dates are enabled
|
||||
if (roundUp && !resultNegative && !result && *stAmountCalcSwitchover)
|
||||
if (roundUp && !resultNegative && !result)
|
||||
{
|
||||
if (isXRP(issue) && *stAmountCalcSwitchover2)
|
||||
if (isXRP(issue))
|
||||
{
|
||||
// return the smallest value above zero
|
||||
amount = 1;
|
||||
|
||||
Reference in New Issue
Block a user