mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
18 Commits
3.1.0-b0
...
vlntb/mem-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2945f74f9b | ||
|
|
40067b4748 | ||
|
|
7025e92080 | ||
|
|
d831cf9b75 | ||
|
|
22b3c0e407 | ||
|
|
f81d0d8c98 | ||
|
|
508937f3d1 | ||
|
|
ab9644267d | ||
|
|
415a412d42 | ||
|
|
2cc54c7c3f | ||
|
|
33e1a19a2e | ||
|
|
12aa7c877a | ||
|
|
bcf9a1ae38 | ||
|
|
f9c642c2b5 | ||
|
|
ba7b561a29 | ||
|
|
265284249c | ||
|
|
6050b84151 | ||
|
|
9006bbda9d |
@@ -145,6 +145,7 @@ test.toplevel > xrpl.json
|
||||
test.unit_test > xrpl.basics
|
||||
tests.libxrpl > xrpl.basics
|
||||
tests.libxrpl > xrpl.json
|
||||
tests.libxrpl > xrpl.ledger
|
||||
tests.libxrpl > xrpl.net
|
||||
xrpl.json > xrpl.basics
|
||||
xrpl.ledger > xrpl.basics
|
||||
|
||||
@@ -151,9 +151,6 @@ public:
|
||||
bool
|
||||
retrieve(key_type const& key, T& data);
|
||||
|
||||
mutex_type&
|
||||
peekMutex();
|
||||
|
||||
std::vector<key_type>
|
||||
getKeys() const;
|
||||
|
||||
|
||||
@@ -649,29 +649,6 @@ TaggedCache<
|
||||
return true;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline auto
|
||||
TaggedCache<
|
||||
Key,
|
||||
T,
|
||||
IsKeyCache,
|
||||
SharedWeakUnionPointer,
|
||||
SharedPointerType,
|
||||
Hash,
|
||||
KeyEqual,
|
||||
Mutex>::peekMutex() -> mutex_type&
|
||||
{
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
|
||||
119
include/xrpl/ledger/LedgerIndexMap.h
Normal file
119
include/xrpl/ledger/LedgerIndexMap.h
Normal file
@@ -0,0 +1,119 @@
|
||||
#ifndef XRPL_APP_LEDGER_INDEX_MAP_H_INCLUDED
|
||||
#define XRPL_APP_LEDGER_INDEX_MAP_H_INCLUDED
|
||||
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
template <class Key, class Mapped>
|
||||
class LedgerIndexMap
|
||||
{
|
||||
public:
|
||||
LedgerIndexMap() = default;
|
||||
explicit LedgerIndexMap(std::size_t reserve_capacity)
|
||||
{
|
||||
data_.reserve(reserve_capacity);
|
||||
}
|
||||
|
||||
LedgerIndexMap(LedgerIndexMap const&) = delete;
|
||||
LedgerIndexMap&
|
||||
operator=(LedgerIndexMap const&) = delete;
|
||||
LedgerIndexMap(LedgerIndexMap&&) = delete;
|
||||
LedgerIndexMap&
|
||||
operator=(LedgerIndexMap&&) = delete;
|
||||
|
||||
Mapped&
|
||||
operator[](Key const& k)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
return data_[k];
|
||||
}
|
||||
|
||||
Mapped&
|
||||
operator[](Key&& k)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
return data_[std::move(k)];
|
||||
}
|
||||
|
||||
[[nodiscard]] Mapped*
|
||||
get(Key const& k)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
auto it = data_.find(k);
|
||||
return it == data_.end() ? nullptr : &it->second;
|
||||
}
|
||||
|
||||
[[nodiscard]] Mapped const*
|
||||
get(Key const& k) const
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
auto it = data_.find(k);
|
||||
return it == data_.end() ? nullptr : &it->second;
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
Mapped&
|
||||
put(Key const& k, Args&&... args)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
auto [it, inserted] = data_.try_emplace(k, std::forward<Args>(args)...);
|
||||
if (!inserted)
|
||||
it->second = Mapped(std::forward<Args>(args)...);
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool
|
||||
contains(Key const& k) const
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
return data_.find(k) != data_.end();
|
||||
}
|
||||
|
||||
std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
return data_.size();
|
||||
}
|
||||
|
||||
bool
|
||||
empty() const noexcept
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
return data_.empty();
|
||||
}
|
||||
|
||||
void
|
||||
reserve(std::size_t n)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
data_.reserve(n);
|
||||
}
|
||||
|
||||
void
|
||||
rehash(std::size_t n)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
data_.rehash(n);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
eraseBefore(Key const& cutoff)
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
auto const before = data_.size();
|
||||
std::erase_if(data_, [&](auto const& kv) { return kv.first < cutoff; });
|
||||
return before - data_.size();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<Key, Mapped> data_;
|
||||
mutable std::mutex mutex_;
|
||||
};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_APP_LEDGER_INDEX_MAP_H_INCLUDED
|
||||
@@ -31,17 +31,8 @@ class STTx final : public STObject, public CountedObject<STTx>
|
||||
TxType tx_type_;
|
||||
|
||||
public:
|
||||
static std::size_t const minMultiSigners = 1;
|
||||
|
||||
// if rules are not supplied then the largest possible value is returned
|
||||
static std::size_t
|
||||
maxMultiSigners(Rules const* rules = 0)
|
||||
{
|
||||
if (rules && !rules->enabled(featureExpandedSignerList))
|
||||
return 8;
|
||||
|
||||
return 32;
|
||||
}
|
||||
static constexpr std::size_t minMultiSigners = 1;
|
||||
static constexpr std::size_t maxMultiSigners = 32;
|
||||
|
||||
STTx() = delete;
|
||||
STTx(STTx const& other) = default;
|
||||
|
||||
@@ -65,13 +65,10 @@ XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo
|
||||
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(ExpandedSignerList, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(TicketBatch, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(NegativeUNL, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(RequireFullyCanonicalSig, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(MultiSignReserve, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Checks, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes)
|
||||
|
||||
@@ -126,13 +123,16 @@ XRPL_RETIRE_FEATURE(DepositAuth)
|
||||
XRPL_RETIRE_FEATURE(DepositPreauth)
|
||||
XRPL_RETIRE_FEATURE(Escrow)
|
||||
XRPL_RETIRE_FEATURE(EnforceInvariants)
|
||||
XRPL_RETIRE_FEATURE(ExpandedSignerList)
|
||||
XRPL_RETIRE_FEATURE(FeeEscalation)
|
||||
XRPL_RETIRE_FEATURE(FlowCross)
|
||||
XRPL_RETIRE_FEATURE(HardenedValidations)
|
||||
XRPL_RETIRE_FEATURE(ImmediateOfferKilled)
|
||||
XRPL_RETIRE_FEATURE(MultiSign)
|
||||
XRPL_RETIRE_FEATURE(MultiSignReserve)
|
||||
XRPL_RETIRE_FEATURE(NonFungibleTokensV1_1)
|
||||
XRPL_RETIRE_FEATURE(PayChan)
|
||||
XRPL_RETIRE_FEATURE(SortedDirectories)
|
||||
XRPL_RETIRE_FEATURE(TicketBatch)
|
||||
XRPL_RETIRE_FEATURE(TickSize)
|
||||
XRPL_RETIRE_FEATURE(TrustSetAuth)
|
||||
|
||||
@@ -155,7 +155,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
||||
#endif
|
||||
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
||||
Delegation::delegatable,
|
||||
featureTicketBatch,
|
||||
uint256{},
|
||||
noPriv,
|
||||
({
|
||||
{sfTicketCount, soeREQUIRED},
|
||||
|
||||
@@ -476,7 +476,7 @@ multiSignHelper(
|
||||
|
||||
// There are well known bounds that the number of signers must be within.
|
||||
if (signers.size() < STTx::minMultiSigners ||
|
||||
signers.size() > STTx::maxMultiSigners(&rules))
|
||||
signers.size() > STTx::maxMultiSigners)
|
||||
return Unexpected("Invalid Signers array size.");
|
||||
|
||||
// Signers must be in sorted order by AccountID.
|
||||
|
||||
@@ -3534,8 +3534,7 @@ private:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}}), sig(alie));
|
||||
env.close();
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 2 : 5};
|
||||
env.require(owners(alice, signerListOwners + 0));
|
||||
env.require(owners(alice, 2));
|
||||
|
||||
msig const ms{becky, bogie};
|
||||
|
||||
@@ -3795,20 +3794,13 @@ private:
|
||||
void
|
||||
testMultisign()
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
|
||||
testTxMultisign(
|
||||
all - featureMultiSignReserve - featureExpandedSignerList);
|
||||
testTxMultisign(all - featureExpandedSignerList);
|
||||
testTxMultisign(all);
|
||||
testTxMultisign(jtx::testable_amendments());
|
||||
}
|
||||
|
||||
void
|
||||
testPayStrand()
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
auto const all = jtx::testable_amendments();
|
||||
|
||||
testToStrand(all);
|
||||
testRIPD1373(all);
|
||||
|
||||
@@ -963,14 +963,8 @@ class Check_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
// Use a regular key and also multisign to cash a check.
|
||||
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||
// check both before and after.
|
||||
for (auto const& testFeatures :
|
||||
{features - featureMultiSignReserve,
|
||||
features | featureMultiSignReserve})
|
||||
{
|
||||
Env env{*this, testFeatures};
|
||||
|
||||
Env env{*this, features};
|
||||
env.fund(XRP(1000), gw, alice, bob);
|
||||
env.close();
|
||||
|
||||
@@ -999,11 +993,7 @@ class Check_test : public beast::unit_test::suite
|
||||
env(signers(bob, 2, {{bogie, 1}, {demon, 1}}), sig(bobby));
|
||||
env.close();
|
||||
|
||||
// If featureMultiSignReserve is enabled then bob's signer list
|
||||
// has an owner count of 1, otherwise it's 4.
|
||||
int const signersCount = {
|
||||
testFeatures[featureMultiSignReserve] ? 1 : 4};
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
|
||||
// bob uses his regular key to cash a check.
|
||||
env(check::cash(bob, chkId1, (USD(1))), sig(bobby));
|
||||
@@ -1013,7 +1003,7 @@ class Check_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 1);
|
||||
BEAST_EXPECT(checksOnAccount(env, bob).size() == 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
|
||||
// bob uses multisigning to cash a check.
|
||||
XRPAmount const baseFeeDrops{env.current()->fees().base};
|
||||
@@ -1026,7 +1016,7 @@ class Check_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 0);
|
||||
BEAST_EXPECT(checksOnAccount(env, bob).size() == 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1605,13 +1595,8 @@ class Check_test : public beast::unit_test::suite
|
||||
Account const zoe{"zoe"};
|
||||
IOU const USD{gw["USD"]};
|
||||
|
||||
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||
// check both before and after.
|
||||
for (auto const& testFeatures :
|
||||
{features - featureMultiSignReserve,
|
||||
features | featureMultiSignReserve})
|
||||
{
|
||||
Env env{*this, testFeatures};
|
||||
Env env{*this, features};
|
||||
|
||||
env.fund(XRP(1000), gw, alice, bob, zoe);
|
||||
env.close();
|
||||
@@ -1729,16 +1714,11 @@ class Check_test : public beast::unit_test::suite
|
||||
env(signers(alice, 2, {{bogie, 1}, {demon, 1}}), sig(alie));
|
||||
env.close();
|
||||
|
||||
// If featureMultiSignReserve is enabled then alices's signer list
|
||||
// has an owner count of 1, otherwise it's 4.
|
||||
int const signersCount{
|
||||
testFeatures[featureMultiSignReserve] ? 1 : 4};
|
||||
|
||||
// alice uses her regular key to cancel a check.
|
||||
env(check::cancel(alice, chkIdReg), sig(alie));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 3);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 3);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 4);
|
||||
|
||||
// alice uses multisigning to cancel a check.
|
||||
XRPAmount const baseFeeDrops{env.current()->fees().base};
|
||||
@@ -1747,18 +1727,18 @@ class Check_test : public beast::unit_test::suite
|
||||
fee(3 * baseFeeDrops));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 2);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 2);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 3);
|
||||
|
||||
// Creator and destination cancel the remaining unexpired checks.
|
||||
env(check::cancel(alice, chkId3), sig(alice));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 1);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||
|
||||
env(check::cancel(bob, chkIdNotExp3));
|
||||
env.close();
|
||||
BEAST_EXPECT(checksOnAccount(env, alice).size() == 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == signersCount + 0);
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1703,7 +1703,6 @@ class Delegate_test : public beast::unit_test::suite
|
||||
// NFTokenMint, NFTokenBurn, NFTokenCreateOffer, NFTokenCancelOffer,
|
||||
// NFTokenAcceptOffer are not included, they are tested separately.
|
||||
std::unordered_map<std::string, uint256> txRequiredFeatures{
|
||||
{"TicketCreate", featureTicketBatch},
|
||||
{"CheckCreate", featureChecks},
|
||||
{"CheckCash", featureChecks},
|
||||
{"CheckCancel", featureChecks},
|
||||
|
||||
@@ -54,37 +54,31 @@ public:
|
||||
Env env{*this, features};
|
||||
Account const alice{"alice", KeyType::secp256k1};
|
||||
|
||||
// The reserve required for a signer list changes with the passage
|
||||
// of featureMultiSignReserve. Make the required adjustments.
|
||||
bool const reserve1{features[featureMultiSignReserve]};
|
||||
|
||||
// Pay alice enough to meet the initial reserve, but not enough to
|
||||
// meet the reserve for a SignerListSet.
|
||||
auto const fee = env.current()->fees().base;
|
||||
auto const smallSignersReserve = reserve1 ? XRP(250) : XRP(350);
|
||||
env.fund(smallSignersReserve - drops(1), alice);
|
||||
env.fund(XRP(250) - drops(1), alice);
|
||||
env.close();
|
||||
env.require(owners(alice, 0));
|
||||
|
||||
{
|
||||
// Attach a signer list to alice. Should fail.
|
||||
Json::Value smallSigners = signers(alice, 1, {{bogie, 1}});
|
||||
env(smallSigners, ter(tecINSUFFICIENT_RESERVE));
|
||||
Json::Value signersList = signers(alice, 1, {{bogie, 1}});
|
||||
env(signersList, ter(tecINSUFFICIENT_RESERVE));
|
||||
env.close();
|
||||
env.require(owners(alice, 0));
|
||||
|
||||
// Fund alice enough to set the signer list, then attach signers.
|
||||
env(pay(env.master, alice, fee + drops(1)));
|
||||
env.close();
|
||||
env(smallSigners);
|
||||
env(signersList);
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 3));
|
||||
env.require(owners(alice, 1));
|
||||
}
|
||||
{
|
||||
// Pay alice enough to almost make the reserve for the biggest
|
||||
// possible list.
|
||||
auto const addReserveBigSigners = reserve1 ? XRP(0) : XRP(350);
|
||||
env(pay(env.master, alice, addReserveBigSigners + fee - drops(1)));
|
||||
env(pay(env.master, alice, fee - drops(1)));
|
||||
|
||||
// Replace with the biggest possible signer list. Should fail.
|
||||
Json::Value bigSigners = signers(
|
||||
@@ -100,14 +94,14 @@ public:
|
||||
{spook, 1}});
|
||||
env(bigSigners, ter(tecINSUFFICIENT_RESERVE));
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 3));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Fund alice one more drop (plus the fee) and succeed.
|
||||
env(pay(env.master, alice, fee + drops(1)));
|
||||
env.close();
|
||||
env(bigSigners);
|
||||
env.close();
|
||||
env.require(owners(alice, reserve1 ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
}
|
||||
// Remove alice's signer list and get the owner count back.
|
||||
env(signers(alice, jtx::none));
|
||||
@@ -170,14 +164,12 @@ public:
|
||||
ter(temBAD_QUORUM));
|
||||
|
||||
// clang-format off
|
||||
// Make a signer list that's too big. Should fail. (Even with
|
||||
// ExpandedSignerList)
|
||||
// Make a signer list that's too big. Should fail.
|
||||
Account const spare("spare", KeyType::secp256k1);
|
||||
env(signers(
|
||||
alice,
|
||||
1,
|
||||
features[featureExpandedSignerList]
|
||||
? std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
{haunt, 1}, {jinni, 1}, {phase, 1},
|
||||
{shade, 1}, {spook, 1}, {spare, 1},
|
||||
{acc10, 1}, {acc11, 1}, {acc12, 1},
|
||||
@@ -187,10 +179,7 @@ public:
|
||||
{acc22, 1}, {acc23, 1}, {acc24, 1},
|
||||
{acc25, 1}, {acc26, 1}, {acc27, 1},
|
||||
{acc28, 1}, {acc29, 1}, {acc30, 1},
|
||||
{acc31, 1}, {acc32, 1}, {acc33, 1}}
|
||||
: std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
|
||||
{haunt, 1}, {jinni, 1}, {phase, 1},
|
||||
{shade, 1}, {spook, 1}, {spare, 1}}),
|
||||
{acc31, 1}, {acc32, 1}, {acc33, 1}}),
|
||||
ter(temMALFORMED));
|
||||
// clang-format on
|
||||
env.close();
|
||||
@@ -211,7 +200,7 @@ public:
|
||||
// Attach phantom signers to alice and use them for a transaction.
|
||||
env(signers(alice, 1, {{bogie, 1}, {demon, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -288,7 +277,7 @@ public:
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -343,7 +332,7 @@ public:
|
||||
// Make sure the transaction fails if they are not.
|
||||
env(signers(alice, 1, {{bogie, 1}, {demon, 1}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
msig phantoms{bogie, demon};
|
||||
std::reverse(phantoms.signers.begin(), phantoms.signers.end());
|
||||
@@ -382,7 +371,7 @@ public:
|
||||
// Attach signers to alice
|
||||
env(signers(alice, 4, {{becky, 3}, {cheri, 4}}), sig(alice));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Attempt a multisigned transaction that meets the quorum.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -751,7 +740,7 @@ public:
|
||||
env(signers(alice, 1, {{becky, 1}, {cheri, 1}, {daria, 1}, {jinni, 1}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 6));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Each type of signer should succeed individually.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -798,7 +787,7 @@ public:
|
||||
{jinni, 0xFFFF}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 6));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
aliceSeq = env.seq(alice);
|
||||
env(noop(alice),
|
||||
@@ -829,7 +818,7 @@ public:
|
||||
{spook, 0xFFFF}}),
|
||||
sig(alie));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 10));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
aliceSeq = env.seq(alice);
|
||||
env(noop(alice),
|
||||
@@ -1005,8 +994,7 @@ public:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}}), sig(alie));
|
||||
env.close();
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 4};
|
||||
env.require(owners(alice, signerListOwners + 0));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Multisign a ttPAYMENT.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -1036,7 +1024,7 @@ public:
|
||||
fee(3 * baseFee),
|
||||
require(lines("alice", 1)));
|
||||
env.close();
|
||||
env.require(owners(alice, signerListOwners + 1));
|
||||
env.require(owners(alice, 2));
|
||||
|
||||
// Multisign a ttOFFER_CREATE transaction.
|
||||
env(pay(gw, alice, USD(50)));
|
||||
@@ -1049,7 +1037,7 @@ public:
|
||||
msig(becky, bogie),
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
env.require(owners(alice, signerListOwners + 2));
|
||||
env.require(owners(alice, 3));
|
||||
|
||||
// Now multisign a ttOFFER_CANCEL canceling the offer we just created.
|
||||
{
|
||||
@@ -1060,7 +1048,7 @@ public:
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
|
||||
env.require(owners(alice, signerListOwners + 1));
|
||||
env.require(owners(alice, 2));
|
||||
}
|
||||
|
||||
// Multisign a ttSIGNER_LIST_SET.
|
||||
@@ -1068,7 +1056,7 @@ public:
|
||||
msig(becky, bogie),
|
||||
fee(3 * baseFee));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 2 : 6));
|
||||
env.require(owners(alice, 2));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1178,56 +1166,44 @@ public:
|
||||
"fails local checks: Invalid Signers array size.");
|
||||
}
|
||||
{
|
||||
// Multisign 9 (!ExpandedSignerList) | 33 (ExpandedSignerList) times
|
||||
// should fail.
|
||||
JTx tx = env.jt(
|
||||
noop(alice),
|
||||
fee(2 * baseFee),
|
||||
|
||||
features[featureExpandedSignerList] ? msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie)
|
||||
: msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie));
|
||||
msig(
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie,
|
||||
bogie));
|
||||
STTx local = *(tx.stx);
|
||||
auto const info = submitSTTx(local);
|
||||
BEAST_EXPECT(
|
||||
@@ -1446,101 +1422,6 @@ public:
|
||||
.asString() == "tesSUCCESS");
|
||||
}
|
||||
|
||||
void
|
||||
testAmendmentTransition()
|
||||
{
|
||||
testcase("Amendment Transition");
|
||||
|
||||
// The OwnerCount associated with a SignerList changes once the
|
||||
// featureMultiSignReserve amendment goes live. Create a couple
|
||||
// of signer lists before and after the amendment goes live and
|
||||
// verify that the OwnerCount is managed properly for all of them.
|
||||
using namespace jtx;
|
||||
Account const alice{"alice", KeyType::secp256k1};
|
||||
Account const becky{"becky", KeyType::ed25519};
|
||||
Account const cheri{"cheri", KeyType::secp256k1};
|
||||
Account const daria{"daria", KeyType::ed25519};
|
||||
|
||||
Env env{*this, testable_amendments() - featureMultiSignReserve};
|
||||
env.fund(XRP(1000), alice, becky, cheri, daria);
|
||||
env.close();
|
||||
|
||||
// Give alice and becky signer lists before the amendment goes live.
|
||||
env(signers(alice, 1, {{bogie, 1}}));
|
||||
env(signers(
|
||||
becky,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 3));
|
||||
env.require(owners(becky, 10));
|
||||
|
||||
// Enable the amendment.
|
||||
env.enableFeature(featureMultiSignReserve);
|
||||
env.close();
|
||||
|
||||
// Give cheri and daria signer lists after the amendment goes live.
|
||||
env(signers(cheri, 1, {{bogie, 1}}));
|
||||
env(signers(
|
||||
daria,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 3));
|
||||
env.require(owners(becky, 10));
|
||||
env.require(owners(cheri, 1));
|
||||
env.require(owners(daria, 1));
|
||||
|
||||
// Delete becky's signer list; her OwnerCount should drop to zero.
|
||||
// Replace alice's signer list; her OwnerCount should drop to one.
|
||||
env(signers(becky, jtx::none));
|
||||
env(signers(
|
||||
alice,
|
||||
1,
|
||||
{{bogie, 1},
|
||||
{demon, 1},
|
||||
{ghost, 1},
|
||||
{haunt, 1},
|
||||
{jinni, 1},
|
||||
{phase, 1},
|
||||
{shade, 1},
|
||||
{spook, 1}}));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 1));
|
||||
env.require(owners(becky, 0));
|
||||
env.require(owners(cheri, 1));
|
||||
env.require(owners(daria, 1));
|
||||
|
||||
// Delete the three remaining signer lists. Everybody's OwnerCount
|
||||
// should now be zero.
|
||||
env(signers(alice, jtx::none));
|
||||
env(signers(cheri, jtx::none));
|
||||
env(signers(daria, jtx::none));
|
||||
env.close();
|
||||
|
||||
env.require(owners(alice, 0));
|
||||
env.require(owners(becky, 0));
|
||||
env.require(owners(cheri, 0));
|
||||
env.require(owners(daria, 0));
|
||||
}
|
||||
|
||||
void
|
||||
testSignersWithTickets(FeatureBitset features)
|
||||
{
|
||||
@@ -1585,9 +1466,6 @@ public:
|
||||
void
|
||||
testSignersWithTags(FeatureBitset features)
|
||||
{
|
||||
if (!features[featureExpandedSignerList])
|
||||
return;
|
||||
|
||||
testcase("Signers With Tags");
|
||||
|
||||
using namespace jtx;
|
||||
@@ -1609,7 +1487,7 @@ public:
|
||||
// Attach phantom signers to alice and use them for a transaction.
|
||||
env(signers(alice, 1, {{bogie, 1, bogie_tag}, {demon, 1, demon_tag}}));
|
||||
env.close();
|
||||
env.require(owners(alice, features[featureMultiSignReserve] ? 1 : 4));
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
@@ -1744,12 +1622,6 @@ public:
|
||||
using namespace jtx;
|
||||
auto const all = testable_amendments();
|
||||
|
||||
// The reserve required on a signer list changes based on
|
||||
// featureMultiSignReserve. Limits on the number of signers
|
||||
// changes based on featureExpandedSignerList. Test both with and
|
||||
// without.
|
||||
testAll(all - featureMultiSignReserve - featureExpandedSignerList);
|
||||
testAll(all - featureExpandedSignerList);
|
||||
testAll(all);
|
||||
|
||||
testSignerListSetFlags(all - fixInvalidTxFlags);
|
||||
@@ -1757,8 +1629,6 @@ public:
|
||||
|
||||
testSignerListObject(all - fixIncludeKeyletFields);
|
||||
testSignerListObject(all);
|
||||
|
||||
testAmendmentTransition();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -727,13 +727,13 @@ private:
|
||||
}
|
||||
|
||||
void
|
||||
testMultisig(FeatureBitset features)
|
||||
testMultisig()
|
||||
{
|
||||
testcase("Multisig");
|
||||
using namespace jtx;
|
||||
Oracle::setFee(100'000);
|
||||
|
||||
Env env(*this, features);
|
||||
Env env(*this);
|
||||
auto const baseFee =
|
||||
static_cast<int>(env.current()->fees().base.drops());
|
||||
|
||||
@@ -753,9 +753,8 @@ private:
|
||||
// Attach signers to alice.
|
||||
env(signers(alice, 2, {{becky, 1}, {bogie, 1}, {ed, 2}}), sig(alie));
|
||||
env.close();
|
||||
// if multiSignReserve disabled then its 2 + 1 per signer
|
||||
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 5};
|
||||
env.require(owners(alice, signerListOwners));
|
||||
|
||||
env.require(owners(alice, 1));
|
||||
|
||||
// Create
|
||||
// Force close (true) and time advancement because the close time
|
||||
@@ -860,11 +859,7 @@ public:
|
||||
testDelete();
|
||||
testUpdate();
|
||||
testAmendment();
|
||||
for (auto const& features :
|
||||
{all,
|
||||
all - featureMultiSignReserve - featureExpandedSignerList,
|
||||
all - featureExpandedSignerList})
|
||||
testMultisig(features);
|
||||
testMultisig();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1889,7 +1889,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(channelAmount(*env.current(), chan) == XRP(1000));
|
||||
|
||||
rmAccount(env, alice, carol, tecHAS_OBLIGATIONS);
|
||||
// can only remove bob if the channel isn't in their owner directory
|
||||
rmAccount(env, bob, carol, TER(tecHAS_OBLIGATIONS));
|
||||
|
||||
auto const feeDrops = env.current()->fees().base;
|
||||
@@ -1904,7 +1903,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
auto authAmt = reqBal + XRP(100);
|
||||
assert(reqBal <= chanAmt);
|
||||
|
||||
// claim should fail if the dst was removed
|
||||
env(claim(alice, chan, reqBal, authAmt));
|
||||
env.close();
|
||||
BEAST_EXPECT(channelBalance(*env.current(), chan) == reqBal);
|
||||
@@ -1912,7 +1910,6 @@ struct PayChan_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(env.balance(bob) == preBob + delta);
|
||||
chanBal = reqBal;
|
||||
|
||||
// fund should fail if the dst was removed
|
||||
auto const preAlice = env.balance(alice);
|
||||
env(fund(alice, chan, XRP(1000)));
|
||||
env.close();
|
||||
|
||||
@@ -360,52 +360,6 @@ class Ticket_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(ticketSeq < acctRootSeq);
|
||||
}
|
||||
|
||||
void
|
||||
testTicketNotEnabled()
|
||||
{
|
||||
testcase("Feature Not Enabled");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env{*this, testable_amendments() - featureTicketBatch};
|
||||
|
||||
env(ticket::create(env.master, 1), ter(temDISABLED));
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
|
||||
env(noop(env.master), ticket::use(1), ter(temMALFORMED));
|
||||
env(noop(env.master),
|
||||
ticket::use(1),
|
||||
seq(env.seq(env.master)),
|
||||
ter(temMALFORMED));
|
||||
|
||||
// Close enough ledgers that the previous transactions are no
|
||||
// longer retried.
|
||||
for (int i = 0; i < 8; ++i)
|
||||
env.close();
|
||||
|
||||
env.enableFeature(featureTicketBatch);
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
|
||||
std::uint32_t ticketSeq{env.seq(env.master) + 1};
|
||||
env(ticket::create(env.master, 2));
|
||||
checkTicketCreateMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 2), tickets(env.master, 2));
|
||||
|
||||
env(noop(env.master), ticket::use(ticketSeq++));
|
||||
checkTicketConsumeMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 1), tickets(env.master, 1));
|
||||
|
||||
env(fset(env.master, asfDisableMaster),
|
||||
ticket::use(ticketSeq++),
|
||||
ter(tecNO_ALTERNATIVE_KEY));
|
||||
checkTicketConsumeMeta(env);
|
||||
env.close();
|
||||
env.require(owners(env.master, 0), tickets(env.master, 0));
|
||||
}
|
||||
|
||||
void
|
||||
testTicketCreatePreflightFail()
|
||||
{
|
||||
@@ -907,70 +861,43 @@ class Ticket_test : public beast::unit_test::suite
|
||||
void
|
||||
testFixBothSeqAndTicket()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
// It is an error if a transaction contains a non-zero Sequence field
|
||||
// and a TicketSequence field. Verify that the error is detected.
|
||||
testcase("Fix both Seq and Ticket");
|
||||
|
||||
// Try the test without featureTicketBatch enabled.
|
||||
using namespace test::jtx;
|
||||
{
|
||||
Env env{*this, testable_amendments() - featureTicketBatch};
|
||||
Account alice{"alice"};
|
||||
Env env{*this, testable_amendments()};
|
||||
Account alice{"alice"};
|
||||
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
|
||||
// Fail to create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1), ter(temDISABLED));
|
||||
env.close();
|
||||
env.require(owners(alice, 0), tickets(alice, 0));
|
||||
BEAST_EXPECT(ticketSeq == env.seq(alice) + 1);
|
||||
// Create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1));
|
||||
env.close();
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. Since a ticket is used and tickets are not yet
|
||||
// enabled the transaction should be malformed.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temMALFORMED));
|
||||
env.close();
|
||||
}
|
||||
// Try the test with featureTicketBatch enabled.
|
||||
{
|
||||
Env env{*this, testable_amendments()};
|
||||
Account alice{"alice"};
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. The transaction fails with temSEQ_AND_TICKET.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temSEQ_AND_TICKET));
|
||||
env.close();
|
||||
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
|
||||
// Create a ticket.
|
||||
std::uint32_t const ticketSeq = env.seq(alice) + 1;
|
||||
env(ticket::create(alice, 1));
|
||||
env.close();
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
|
||||
// Create a transaction that includes both a ticket and a non-zero
|
||||
// sequence number. The transaction fails with temSEQ_AND_TICKET.
|
||||
env(noop(alice),
|
||||
ticket::use(ticketSeq),
|
||||
seq(env.seq(alice)),
|
||||
ter(temSEQ_AND_TICKET));
|
||||
env.close();
|
||||
|
||||
// Verify that the transaction failed by looking at alice's
|
||||
// sequence number and tickets.
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
}
|
||||
// Verify that the transaction failed by looking at alice's
|
||||
// sequence number and tickets.
|
||||
env.require(owners(alice, 1), tickets(alice, 1));
|
||||
BEAST_EXPECT(ticketSeq + 1 == env.seq(alice));
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testTicketNotEnabled();
|
||||
testTicketCreatePreflightFail();
|
||||
testTicketCreatePreclaimFail();
|
||||
testTicketInsufficientReserve();
|
||||
|
||||
@@ -798,17 +798,16 @@ public:
|
||||
|
||||
{
|
||||
// a Env FeatureBitset has *only* those features
|
||||
Env env{*this, FeatureBitset(featureMultiSignReserve, featureFlow)};
|
||||
Env env{*this, FeatureBitset{featureDynamicMPT | featureFlow}};
|
||||
BEAST_EXPECT(env.app().config().features.size() == 2);
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool const has =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool const has = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
|
||||
auto const missingSomeFeatures =
|
||||
testable_amendments() - featureMultiSignReserve - featureFlow;
|
||||
testable_amendments() - featureDynamicMPT - featureFlow;
|
||||
BEAST_EXPECT(missingSomeFeatures.count() == (supported.count() - 2));
|
||||
{
|
||||
// a Env supported_features_except is missing *only* those features
|
||||
@@ -816,8 +815,7 @@ public:
|
||||
BEAST_EXPECT(
|
||||
env.app().config().features.size() == (supported.count() - 2));
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool hasnot =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
@@ -829,8 +827,8 @@ public:
|
||||
// the two supported ones
|
||||
Env env{
|
||||
*this,
|
||||
FeatureBitset(
|
||||
featureMultiSignReserve, featureFlow, *neverSupportedFeat)};
|
||||
FeatureBitset{
|
||||
featureDynamicMPT, featureFlow, *neverSupportedFeat}};
|
||||
|
||||
// this app will have just 2 supported amendments and
|
||||
// one additional never supported feature flag
|
||||
@@ -838,7 +836,7 @@ public:
|
||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool has = (f == featureMultiSignReserve || f == featureFlow);
|
||||
bool has = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(has == hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
@@ -858,8 +856,7 @@ public:
|
||||
(supported.count() - 2 + 1));
|
||||
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
|
||||
foreachFeature(supported, [&](uint256 const& f) {
|
||||
bool hasnot =
|
||||
(f == featureMultiSignReserve || f == featureFlow);
|
||||
bool hasnot = (f == featureDynamicMPT || f == featureFlow);
|
||||
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1612,7 +1612,7 @@ public:
|
||||
// proper lifetime.
|
||||
std::unordered_set<uint256, beast::uhash<>> const presets;
|
||||
Rules const defaultRules{presets};
|
||||
BEAST_EXPECT(!defaultRules.enabled(featureExpandedSignerList));
|
||||
BEAST_EXPECT(!defaultRules.enabled(featureAMM));
|
||||
|
||||
unexpected(
|
||||
!j.checkSign(STTx::RequireFullyCanonicalSig::yes, defaultRules),
|
||||
|
||||
@@ -183,16 +183,16 @@ class Feature_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this};
|
||||
|
||||
auto jrr = env.rpc("feature", "MultiSignReserve")[jss::result];
|
||||
auto jrr = env.rpc("feature", "RequireFullyCanonicalSig")[jss::result];
|
||||
BEAST_EXPECTS(jrr[jss::status] == jss::success, "status");
|
||||
jrr.removeMember(jss::status);
|
||||
BEAST_EXPECT(jrr.size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jrr.isMember("586480873651E106F1D6339B0C4A8945BA705A777F3F4524626FF"
|
||||
"1FC07EFE41D"));
|
||||
jrr.isMember("00C1FC4A53E60AB02C864641002B3172F38677E29C26C54066851"
|
||||
"79B37E1EDAC"));
|
||||
auto feature = *(jrr.begin());
|
||||
|
||||
BEAST_EXPECTS(feature[jss::name] == "MultiSignReserve", "name");
|
||||
BEAST_EXPECTS(feature[jss::name] == "RequireFullyCanonicalSig", "name");
|
||||
BEAST_EXPECTS(!feature[jss::enabled].asBool(), "enabled");
|
||||
BEAST_EXPECTS(
|
||||
feature[jss::vetoed].isBool() && !feature[jss::vetoed].asBool(),
|
||||
@@ -200,7 +200,7 @@ class Feature_test : public beast::unit_test::suite
|
||||
BEAST_EXPECTS(feature[jss::supported].asBool(), "supported");
|
||||
|
||||
// feature names are case-sensitive - expect error here
|
||||
jrr = env.rpc("feature", "multiSignReserve")[jss::result];
|
||||
jrr = env.rpc("feature", "requireFullyCanonicalSig")[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "badFeature");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Feature unknown or invalid.");
|
||||
}
|
||||
@@ -476,8 +476,8 @@ class Feature_test : public beast::unit_test::suite
|
||||
testcase("Veto");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env{*this, FeatureBitset(featureMultiSignReserve)};
|
||||
constexpr char const* featureName = "MultiSignReserve";
|
||||
Env env{*this, FeatureBitset{featureRequireFullyCanonicalSig}};
|
||||
constexpr char const* featureName = "RequireFullyCanonicalSig";
|
||||
|
||||
auto jrr = env.rpc("feature", featureName)[jss::result];
|
||||
if (!BEAST_EXPECTS(jrr[jss::status] == jss::success, "status"))
|
||||
|
||||
@@ -29,3 +29,7 @@ if(NOT WIN32)
|
||||
target_link_libraries(xrpl.test.net PRIVATE xrpl.imports.test)
|
||||
add_dependencies(xrpl.tests xrpl.test.net)
|
||||
endif()
|
||||
|
||||
xrpl_add_test(ledger)
|
||||
target_link_libraries(xrpl.test.ledger PRIVATE xrpl.imports.test)
|
||||
add_dependencies(xrpl.tests xrpl.test.ledger)
|
||||
|
||||
191
src/tests/libxrpl/ledger/LedgerIndexMap.cpp
Normal file
191
src/tests/libxrpl/ledger/LedgerIndexMap.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
#include <xrpl/ledger/LedgerIndexMap.h>
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace ripple;
|
||||
|
||||
TEST_SUITE_BEGIN("LedgerIndexMap");
|
||||
|
||||
using TestMap = LedgerIndexMap<int, std::string>;
|
||||
|
||||
TEST_CASE("Default empty")
|
||||
{
|
||||
TestMap m;
|
||||
CHECK(m.size() == 0);
|
||||
CHECK(m.empty());
|
||||
CHECK(m.get(42) == nullptr);
|
||||
CHECK_FALSE(m.contains(42));
|
||||
}
|
||||
|
||||
TEST_CASE("Operator bracket inserts default")
|
||||
{
|
||||
TestMap m;
|
||||
auto& v = m[10];
|
||||
CHECK(m.size() == 1);
|
||||
CHECK(m.contains(10));
|
||||
CHECK(v.empty());
|
||||
}
|
||||
|
||||
TEST_CASE("Operator bracket, rvalue key")
|
||||
{
|
||||
TestMap m;
|
||||
int k = 7;
|
||||
auto& v1 = m[std::move(k)];
|
||||
v1 = "seven";
|
||||
CHECK(m.size() == 1);
|
||||
auto* got = m.get(7);
|
||||
REQUIRE(got != nullptr);
|
||||
CHECK(*got == "seven");
|
||||
}
|
||||
|
||||
TEST_CASE("Insert through put")
|
||||
{
|
||||
TestMap m;
|
||||
auto& v = m.put(20, "twenty");
|
||||
CHECK(v == "twenty");
|
||||
auto* got = m.get(20);
|
||||
REQUIRE(got != nullptr);
|
||||
CHECK(*got == "twenty");
|
||||
CHECK(m.size() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Overwrite existing key with put")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(5, "five");
|
||||
CHECK(m.size() == 1);
|
||||
m.put(5, "FIVE");
|
||||
CHECK(m.size() == 1);
|
||||
auto* got = m.get(5);
|
||||
REQUIRE(got != nullptr);
|
||||
CHECK(*got == "FIVE");
|
||||
}
|
||||
|
||||
TEST_CASE("Once found, one not found")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(1, "one");
|
||||
CHECK(m.get(1) != nullptr);
|
||||
CHECK(m.get(2) == nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("Try eraseBefore - nothing to do")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(10, "a");
|
||||
m.put(11, "b");
|
||||
m.put(12, "c");
|
||||
CHECK(m.eraseBefore(10) == 0);
|
||||
CHECK(m.size() == 3);
|
||||
CHECK(m.contains(10));
|
||||
CHECK(m.contains(11));
|
||||
CHECK(m.contains(12));
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - removes several entries")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(10, "a");
|
||||
m.put(11, "b");
|
||||
m.put(12, "c");
|
||||
m.put(13, "d");
|
||||
CHECK(m.eraseBefore(12) == 2);
|
||||
CHECK_FALSE(m.contains(10));
|
||||
CHECK_FALSE(m.contains(11));
|
||||
CHECK(m.contains(12));
|
||||
CHECK(m.contains(13));
|
||||
CHECK(m.size() == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - removes all entries")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(1, "x");
|
||||
m.put(2, "y");
|
||||
CHECK(m.eraseBefore(1000) == 2);
|
||||
CHECK(m.size() == 0);
|
||||
CHECK(m.empty());
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - same call, second time nothing to do")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(10, "a");
|
||||
m.put(11, "b");
|
||||
m.put(12, "c");
|
||||
CHECK(m.eraseBefore(12) == 2);
|
||||
CHECK(m.contains(12));
|
||||
CHECK(m.eraseBefore(12) == 0);
|
||||
CHECK(m.size() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - single entry removed")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(10, "v1");
|
||||
m.put(10, "v2");
|
||||
m.put(10, "v3");
|
||||
CHECK(m.size() == 1);
|
||||
CHECK(m.eraseBefore(11) == 1);
|
||||
CHECK(m.size() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - outlier still removed in one call")
|
||||
{
|
||||
TestMap m;
|
||||
m.put(10, "a");
|
||||
m.put(12, "c");
|
||||
m.put(11, "b"); // out-of-order insert
|
||||
|
||||
CHECK(m.eraseBefore(12) == 2); // removes 10 and 11
|
||||
CHECK_FALSE(m.contains(10));
|
||||
CHECK_FALSE(m.contains(11));
|
||||
CHECK(m.contains(12));
|
||||
CHECK(m.size() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("eraseBefore - erase in two steps (one first, then some more)")
|
||||
{
|
||||
TestMap m;
|
||||
for (int k : {10, 11, 12, 13})
|
||||
m.put(k, std::to_string(k));
|
||||
|
||||
CHECK(m.eraseBefore(11) == 1);
|
||||
CHECK_FALSE(m.contains(10));
|
||||
CHECK(m.size() == 3);
|
||||
|
||||
CHECK(m.eraseBefore(13) == 2);
|
||||
CHECK_FALSE(m.contains(11));
|
||||
CHECK_FALSE(m.contains(12));
|
||||
CHECK(m.contains(13));
|
||||
CHECK(m.size() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("rehash does not lose entries")
|
||||
{
|
||||
TestMap m;
|
||||
for (int k = 0; k < 16; ++k)
|
||||
m.put(k, "v" + std::to_string(k));
|
||||
|
||||
m.reserve(64);
|
||||
m.rehash(32);
|
||||
|
||||
for (int k = 0; k < 16; ++k)
|
||||
{
|
||||
auto* v = m.get(k);
|
||||
REQUIRE(v != nullptr);
|
||||
CHECK(*v == "v" + std::to_string(k));
|
||||
}
|
||||
|
||||
CHECK(m.eraseBefore(8) == 8);
|
||||
for (int k = 0; k < 8; ++k)
|
||||
CHECK_FALSE(m.contains(k));
|
||||
for (int k = 8; k < 16; ++k)
|
||||
CHECK(m.contains(k));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
2
src/tests/libxrpl/ledger/main.cpp
Normal file
2
src/tests/libxrpl/ledger/main.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include <doctest/doctest.h>
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// FIXME: Need to clean up ledgers by index at some point
|
||||
|
||||
LedgerHistory::LedgerHistory(
|
||||
beast::insight::Collector::ptr const& collector,
|
||||
Application& app)
|
||||
@@ -28,6 +26,7 @@ LedgerHistory::LedgerHistory(
|
||||
std::chrono::minutes{5},
|
||||
stopwatch(),
|
||||
app_.journal("TaggedCache"))
|
||||
, mLedgersByIndex(512)
|
||||
, j_(app.journal("LedgerHistory"))
|
||||
{
|
||||
}
|
||||
@@ -44,8 +43,6 @@ LedgerHistory::insert(
|
||||
ledger->stateMap().getHash().isNonZero(),
|
||||
"ripple::LedgerHistory::insert : nonzero hash");
|
||||
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
bool const alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache(
|
||||
ledger->info().hash, ledger);
|
||||
if (validated)
|
||||
@@ -57,25 +54,18 @@ LedgerHistory::insert(
|
||||
LedgerHash
|
||||
LedgerHistory::getLedgerHash(LedgerIndex index)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
if (auto it = mLedgersByIndex.find(index); it != mLedgersByIndex.end())
|
||||
return it->second;
|
||||
if (auto p = mLedgersByIndex.get(index))
|
||||
return *p;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::shared_ptr<Ledger const>
|
||||
LedgerHistory::getLedgerBySeq(LedgerIndex index)
|
||||
{
|
||||
if (auto p = mLedgersByIndex.get(index))
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
{
|
||||
uint256 hash = it->second;
|
||||
sl.unlock();
|
||||
return getLedgerByHash(hash);
|
||||
}
|
||||
uint256 const hash = *p;
|
||||
return getLedgerByHash(hash);
|
||||
}
|
||||
|
||||
std::shared_ptr<Ledger const> ret = loadByIndex(index, app_);
|
||||
@@ -89,8 +79,6 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index)
|
||||
|
||||
{
|
||||
// Add this ledger to the local tracking by index
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
XRPL_ASSERT(
|
||||
ret->isImmutable(),
|
||||
"ripple::LedgerHistory::getLedgerBySeq : immutable result ledger");
|
||||
@@ -439,8 +427,6 @@ LedgerHistory::builtLedger(
|
||||
XRPL_ASSERT(
|
||||
!hash.isZero(), "ripple::LedgerHistory::builtLedger : nonzero hash");
|
||||
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex());
|
||||
|
||||
auto entry = std::make_shared<cv_entry>();
|
||||
m_consensus_validated.canonicalize_replace_client(index, entry);
|
||||
|
||||
@@ -481,8 +467,6 @@ LedgerHistory::validatedLedger(
|
||||
!hash.isZero(),
|
||||
"ripple::LedgerHistory::validatedLedger : nonzero hash");
|
||||
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex());
|
||||
|
||||
auto entry = std::make_shared<cv_entry>();
|
||||
m_consensus_validated.canonicalize_replace_client(index, entry);
|
||||
|
||||
@@ -516,13 +500,13 @@ LedgerHistory::validatedLedger(
|
||||
bool
|
||||
LedgerHistory::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
auto it = mLedgersByIndex.find(ledgerIndex);
|
||||
|
||||
if ((it != mLedgersByIndex.end()) && (it->second != ledgerHash))
|
||||
if (auto cur = mLedgersByIndex.get(ledgerIndex))
|
||||
{
|
||||
it->second = ledgerHash;
|
||||
return false;
|
||||
if (*cur != ledgerHash)
|
||||
{
|
||||
mLedgersByIndex.put(ledgerIndex, ledgerHash);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -530,12 +514,24 @@ LedgerHistory::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
|
||||
void
|
||||
LedgerHistory::clearLedgerCachePrior(LedgerIndex seq)
|
||||
{
|
||||
std::size_t hashesCleared = 0;
|
||||
for (LedgerHash it : m_ledgers_by_hash.getKeys())
|
||||
{
|
||||
auto const ledger = getLedgerByHash(it);
|
||||
if (!ledger || ledger->info().seq < seq)
|
||||
{
|
||||
m_ledgers_by_hash.del(it, false);
|
||||
++hashesCleared;
|
||||
}
|
||||
}
|
||||
JLOG(j_.debug()) << "LedgersByHash: cleared " << hashesCleared
|
||||
<< " entries before seq " << seq << " (total now "
|
||||
<< m_ledgers_by_hash.size() << ")";
|
||||
|
||||
std::size_t const indexesCleared = mLedgersByIndex.eraseBefore(seq);
|
||||
JLOG(j_.debug()) << "LedgerIndexMap: cleared " << indexesCleared
|
||||
<< " index entries before seq " << seq << " (total now "
|
||||
<< mLedgersByIndex.size() << ")";
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <xrpld/app/main/Application.h>
|
||||
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
#include <xrpl/ledger/LedgerIndexMap.h>
|
||||
#include <xrpl/protocol/RippleLedgerHash.h>
|
||||
|
||||
#include <optional>
|
||||
@@ -130,7 +131,8 @@ private:
|
||||
ConsensusValidated m_consensus_validated;
|
||||
|
||||
// Maps ledger indexes to the corresponding hash.
|
||||
std::map<LedgerIndex, LedgerHash> mLedgersByIndex; // validated ledgers
|
||||
ripple::LedgerIndexMap<LedgerIndex, LedgerHash>
|
||||
mLedgersByIndex; // validated ledgers
|
||||
|
||||
beast::Journal j_;
|
||||
};
|
||||
|
||||
@@ -142,10 +142,6 @@ SetSignerList::preCompute()
|
||||
|
||||
// The return type is signed so it is compatible with the 3rd argument
|
||||
// of adjustOwnerCount() (which must be signed).
|
||||
//
|
||||
// NOTE: This way of computing the OwnerCount associated with a SignerList
|
||||
// is valid until the featureMultiSignReserve amendment passes. Once it
|
||||
// passes then just 1 OwnerCount is associated with a SignerList.
|
||||
static int
|
||||
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
|
||||
{
|
||||
@@ -162,13 +158,13 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
|
||||
// units. A SignerList with 8 entries would cost 10 OwnerCount units.
|
||||
//
|
||||
// The static_cast should always be safe since entryCount should always
|
||||
// be in the range from 1 to 8 (or 32 if ExpandedSignerList is enabled).
|
||||
// be in the range from 1 to 32.
|
||||
// We've got a lot of room to grow.
|
||||
XRPL_ASSERT(
|
||||
entryCount >= STTx::minMultiSigners,
|
||||
"ripple::signerCountBasedOwnerCountDelta : minimum signers");
|
||||
XRPL_ASSERT(
|
||||
entryCount <= STTx::maxMultiSigners(&rules),
|
||||
entryCount <= STTx::maxMultiSigners,
|
||||
"ripple::signerCountBasedOwnerCountDelta : maximum signers");
|
||||
return 2 + static_cast<int>(entryCount);
|
||||
}
|
||||
@@ -250,8 +246,8 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
// Reject if there are too many or too few entries in the list.
|
||||
{
|
||||
std::size_t const signerCount = signers.size();
|
||||
if ((signerCount < STTx::minMultiSigners) ||
|
||||
(signerCount > STTx::maxMultiSigners(&rules)))
|
||||
if (signerCount < STTx::minMultiSigners ||
|
||||
signerCount > STTx::maxMultiSigners)
|
||||
{
|
||||
JLOG(j.trace()) << "Too many or too few signers in signer list.";
|
||||
return temMALFORMED;
|
||||
@@ -269,9 +265,6 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
// Is the ExpandedSignerList amendment active?
|
||||
bool const expandedSignerList = rules.enabled(featureExpandedSignerList);
|
||||
|
||||
// Make sure no signers reference this account. Also make sure the
|
||||
// quorum can be reached.
|
||||
std::uint64_t allSignersWeight(0);
|
||||
@@ -291,15 +284,6 @@ SetSignerList::validateQuorumAndSignerEntries(
|
||||
JLOG(j.trace()) << "A signer may not self reference account.";
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
if (signer.tag && !expandedSignerList)
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: sfWalletLocator "
|
||||
"specified in SignerEntry "
|
||||
<< "but featureExpandedSignerList is not enabled.";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
// Don't verify that the signer accounts exist. Non-existent accounts
|
||||
// may be phantom accounts (which are permitted).
|
||||
}
|
||||
@@ -337,15 +321,8 @@ SetSignerList::replaceSignerList()
|
||||
// Compute new reserve. Verify the account has funds to meet the reserve.
|
||||
std::uint32_t const oldOwnerCount{(*sle)[sfOwnerCount]};
|
||||
|
||||
// The required reserve changes based on featureMultiSignReserve...
|
||||
int addedOwnerCount{1};
|
||||
constexpr int addedOwnerCount = 1;
|
||||
std::uint32_t flags{lsfOneOwnerCount};
|
||||
if (!ctx_.view().rules().enabled(featureMultiSignReserve))
|
||||
{
|
||||
addedOwnerCount = signerCountBasedOwnerCountDelta(
|
||||
signers_.size(), ctx_.view().rules());
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
XRPAmount const newReserve{
|
||||
view().fees().accountReserve(oldOwnerCount + addedOwnerCount)};
|
||||
@@ -415,9 +392,6 @@ SetSignerList::writeSignersToSLE(
|
||||
if (flags) // Only set flags if they are non-default (default is zero).
|
||||
ledgerEntry->setFieldU32(sfFlags, flags);
|
||||
|
||||
bool const expandedSignerList =
|
||||
ctx_.view().rules().enabled(featureExpandedSignerList);
|
||||
|
||||
// Create the SignerListArray one SignerEntry at a time.
|
||||
STArray toLedger(signers_.size());
|
||||
for (auto const& entry : signers_)
|
||||
@@ -429,8 +403,8 @@ SetSignerList::writeSignersToSLE(
|
||||
obj[sfSignerWeight] = entry.weight;
|
||||
|
||||
// This is a defensive check to make absolutely sure we will never write
|
||||
// a tag into the ledger while featureExpandedSignerList is not enabled
|
||||
if (expandedSignerList && entry.tag)
|
||||
// a tag into the ledger.
|
||||
if (entry.tag)
|
||||
obj.setFieldH256(sfWalletLocator, *(entry.tag));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ SignerEntries::deserialize(
|
||||
}
|
||||
|
||||
std::vector<SignerEntry> accountVec;
|
||||
accountVec.reserve(STTx::maxMultiSigners());
|
||||
accountVec.reserve(STTx::maxMultiSigners);
|
||||
|
||||
STArray const& sEntries(obj.getFieldArray(sfSignerEntries));
|
||||
for (STObject const& sEntry : sEntries)
|
||||
|
||||
@@ -143,14 +143,6 @@ preflightCheckSimulateKeys(
|
||||
NotTEC
|
||||
Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
{
|
||||
// This is inappropriate in preflight0, because only Change transactions
|
||||
// skip this function, and those do not allow an sfTicketSequence field.
|
||||
if (ctx.tx.isFieldPresent(sfTicketSequence) &&
|
||||
!ctx.rules.enabled(featureTicketBatch))
|
||||
{
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfDelegate))
|
||||
{
|
||||
if (!ctx.rules.enabled(featurePermissionDelegationV1_1))
|
||||
@@ -442,8 +434,7 @@ Transactor::checkSeqProxy(
|
||||
|
||||
if (t_seqProx.isSeq())
|
||||
{
|
||||
if (tx.isFieldPresent(sfTicketSequence) &&
|
||||
view.rules().enabled(featureTicketBatch))
|
||||
if (tx.isFieldPresent(sfTicketSequence))
|
||||
{
|
||||
JLOG(j.trace()) << "applyTransaction: has both a TicketSequence "
|
||||
"and a non-zero Sequence number";
|
||||
|
||||
@@ -822,7 +822,7 @@ getTxFee(Application const& app, Config const& config, Json::Value tx)
|
||||
if (!tx[jss::Signers].isArray())
|
||||
return config.FEES.reference_fee;
|
||||
|
||||
if (tx[jss::Signers].size() > STTx::maxMultiSigners(&ledger->rules()))
|
||||
if (tx[jss::Signers].size() > STTx::maxMultiSigners)
|
||||
return config.FEES.reference_fee;
|
||||
|
||||
// check multi-signed signers
|
||||
|
||||
Reference in New Issue
Block a user